feat: Add config serialization and loading support#36
Conversation
|
📦 Build Artifacts Available |
a56e3c4 to
6771fd1
Compare
serialization support - Add LlamaEagleSpeculator model class - Implement model serialization/deserialization - Add torch as a project dependency - Include unit and integration tests - Fixes for serialization handling This introduces the core LlamaEagleSpeculator functionality with full serialization support
…for the Eagle config
- Implement from_pretrained() for loading configs from HF Hub or local paths - Add from_dict() with polymorphic instantiation using registry pattern - Implement to_dict() for EagleSpeculatorConfig with proper serialization - Handle nested config reconstruction (transformer_layer_config, etc.) - Update comments to explain "why" rather than "what" - Add comprehensive unit tests for serialization roundtrips - Remove incompatible legacy tests expecting NotImplementedError Co-Authored-By: rtuli@redhat.com
e1aa106 to
e3f9e7f
Compare
|
📦 Build Artifacts Available |
markurtz
left a comment
There was a problem hiding this comment.
Noting here, working through simplifying this diff
…tation to use Pydantic compatible pathways
|
📦 Build Artifacts Available |
|
📦 Build Artifacts Available |
markurtz
left a comment
There was a problem hiding this comment.
Removing my request changes block now that it's been reworked to utilize Pydantic builtins and reduce the complexity of the logic
There was a problem hiding this comment.
Pull Request Overview
This PR adds configuration serialization and deserialization support for speculator models, including methods for loading from local paths or the HuggingFace Hub as well as proper handling of nested configurations. Key changes include:
- Implementing from_pretrained, from_dict, and to_dict methods with registry support.
- Adding new field serialization and validation logic for EagleSpeculatorConfig.
- Updating and expanding unit and integration tests for configuration marshalling.
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Updated Python environment list to drop py38. |
| tests/unit/test_config.py | Refactored tests with updated markers and added additional marshalling tests. |
| tests/unit/models/test_eagle.py | Expanded coverage for EagleSpeculatorConfig including backwards compatibility. |
| tests/integration/test_config.py | Replaced a temporary failure test for from_pretrained with a stub. |
| src/speculators/models/eagle.py | Added field serialization and validation for transformer_layer_config. |
| src/speculators/config.py | Revised configuration loading (from_pretrained, from_dict) and init logic. |
| pyproject.toml | Updated lint rule codes to match new guidelines. |
Comments suppressed due to low confidence (1)
tests/integration/test_config.py:44
- This placeholder test for from_pretrained does not currently validate actual loading behavior. Once the functionality is fully implemented, please add comprehensive tests to ensure proper integration.
assert True
brian-dellabetta
left a comment
There was a problem hiding this comment.
nit to remove extraneous test, otherwise LGTM
PR 1: Add Config Serialization and Loading Support
Summary
Implements
from_pretrained,to_dict, andfrom_dictmethods for SpeculatorModelConfig to enable loading and saving configurations from the HuggingFace Hub and local paths. This is a prerequisite for model implementations that need these serialization capabilities.Changes
Core Implementation
Technical Details
Registry Pattern
Nested Config Handling
transformer_layer_config→ LlamaConfigspeculators_config→ SpeculatorsConfigtoken_proposals→ TokenProposalConfigComment Improvements
Testing
API Changes
Example Usage
Review Notes