Repository navigation
Fix L2 failures: arctic RoPE and Phi4-MM rope standardization - #230
Merged
Merged
Conversation
- Add arctic to _IMPLICIT_ROPE_DEFAULTS (rope_theta=10000 default with rope_scaling=null provides no RoPE signal, but the model uses RoPE) - Fix _dict_to_pretrained_config for newer transformers: proactively strip rope fields from composite configs, and fall back to strip + restore for flat configs where PretrainedConfig rope standardization crashes (Phi4-MM longrope format) Co-authored-by: Copilot <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses RoPE-related config resolution issues that were causing L2 test failures for Arctic and Phi4-MM models by improving RoPE signal handling and making config dict → PretrainedConfig conversion more robust against transformers’ rope standardization changes.
Changes:
- Add
arcticto_IMPLICIT_ROPE_DEFAULTSso RoPE is initialized even when config JSON has only defaultrope_thetaandrope_scaling=null. - Update
_dict_to_pretrained_configto (a) strip top-level RoPE fields only for composite configs and (b) retryPretrainedConfigconstruction without RoPE fields on init failure, then restore them as attributes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/mobius/_configs.py |
Adds an implicit RoPE default for arctic to avoid missing rotary embedding initialization. |
src/mobius/_config_resolver.py |
Improves resilience to transformers RoPE standardization by stripping duplicate top-level rope fields for composite configs and adding a retry/restore fallback on config init errors. |
- Add tests for composite rope stripping, flat config preservation, and retry/restore path in _config_resolver_test.py - Add test for arctic implicit RoPE defaults in _configs_test.py - Include caught exception in retry debug log message Co-authored-by: Copilot <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 8 L2 test failures (arctic ×2, phi4_multimodal ×3, phi4mm ×3).
Arctic (TypeError: rotary_emb is None)
Arctic's config JSON has
rope_theta=10000(the default) andrope_scaling=null. No signal triggers_extract_rope_config(), sorotary_embis never created — but the model uses RoPE.Fix: Add
arcticto_IMPLICIT_ROPE_DEFAULTSwithrope_theta=10000.0.Phi4-MM (AttributeError: max_position_embeddings)
Newer transformers (
convert_rope_params_to_dict→standardize_rope_params) accessesself.max_position_embeddingsbefore it's set as an attribute onPretrainedConfig. This crashes even whenmax_position_embeddingsis in the kwargs dict.Fix: Two-layer defense in
_dict_to_pretrained_config:_extract_rope_configcan still read them