Skip to content

Conversation

markurtz
Copy link
Collaborator

No description provided.

@markurtz markurtz marked this pull request as draft July 10, 2025 16:15
Copy link

github-actions bot commented Jul 10, 2025

📦 Build Artifacts Available
The build artifacts (`.whl` and `.tar.gz`) have been successfully generated and are available for download: https://github.com/neuralmagic/speculators/actions/runs/16305447937/artifacts/3540454686.
They will be retained for up to 30 days.
Commit: 9d71e76

@rahul-tuli rahul-tuli changed the base branch from main to eagle-conversion July 10, 2025 17:18
@rahul-tuli rahul-tuli changed the base branch from eagle-conversion to feat/eagle-converter July 10, 2025 17:23
@rahul-tuli rahul-tuli force-pushed the feat/converter-architecture branch from 545b7f5 to 9a3afc3 Compare July 10, 2025 17:30
Base automatically changed from feat/eagle-converter to main July 10, 2025 18:54
rahul-tuli and others added 11 commits July 13, 2025 19:57
- Implement EagleConverter class for converting Eagle/HASS checkpoints
- Support standard Eagle and layernorms variants
- Map weights correctly (fc→fusion_fc, layers.0→transformer)
- Skip embed_tokens.weight due to weight tying
- Add comprehensive unit and e2e tests
Major refactoring to improve code organization and reusability:

- Extract 6 generic utility functions to utils.py:
  * download_checkpoint_from_hub
  * ensure_checkpoint_is_local
  * load_checkpoint_config
  * load_checkpoint_weights
  * detect_fusion_bias_and_layernorms (renamed for clarity)
  * save_speculator_checkpoint (uses save_pretrained)

- Keep Eagle-specific logic in EagleConverter class:
  * Weight name remapping
  * Config translation
  * Architecture validation

- Split weight processing into two functions:
  * _should_skip_weight: Determines if weight should be skipped
  * _remap_weight_name: Handles the actual name remapping

- Move SpeculatorModelConfig import to module level
- Add comprehensive RST docstrings with usage examples
- Update tests to use new utils module

This separation enables reuse of generic utilities for future
speculator implementations (Medusa, Hydra, etc.) while keeping
architecture-specific logic isolated.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Get vocab_size, hidden_size, and max_position_embeddings from model config
- Use conservative sequence length that respects model's max_position_embeddings
- Improve exception variable naming for clarity
- Add more detailed logging of forward pass parameters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Initialize EagleSpeculator with verifier_attachment_mode='detached' to prevent verifier loading
- Use model.load_state_dict with strict=False to load only Eagle-specific weights
- Let model.save_pretrained handle saving config, weights, and auto-generated code
- Update test to check for eagle.py instead of mocking save_file
- Remove unused save_speculator_checkpoint function from utils

This approach leverages the model's native save method while avoiding
verifier dependency issues during conversion.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fixed meta device issue by loading converted weights before saving
- Applied style fixes (simplified return, fixed line lengths)
- Moved e2e conversion tests to tests/e2e/convert/
- Added comprehensive unit tests for Eagle converter utilities

The missing model.load_state_dict(weights, strict=False) call was causing
converted checkpoints to save without weights, resulting in models loading
on meta device.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…re styling is passing. Migration of tests pending
@markurtz markurtz force-pushed the feat/converter-architecture branch from 9a3afc3 to 389dc2b Compare July 15, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants