fix(export): preserve both RoPE scaling schemas - #742
Open
Boreas618 wants to merge 2 commits into
Open
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Boreas618
force-pushed
the
agent/dual-rope-export
branch
from
August 1, 2026 17:32
4f275cd to
0412328
Compare
transformers 5.x save_pretrained keeps only the new rope_parameters schema and drops legacy rope_scaling. Serving stacks and older transformers that read only the legacy key then silently lose YaRN on long-context checkpoints (the draft falls back to unscaled RoPE at serve time — accept length collapses beyond the original context). Mirror whichever schema survives into the other at save time; default (non-scaled) RoPE configs are left untouched.
Boreas618
force-pushed
the
agent/dual-rope-export
branch
from
August 1, 2026 18:52
0412328 to
108eda3
Compare
Boreas618
marked this pull request as ready for review
August 1, 2026 18:52
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
What changed
rope_parametersand legacyrope_scalingschemas after HF or SGLang export when serialization keeps only one form.rope_thetawhen constructing the modern representation.Why
Transformers 5 serializes the modern schema, while older Transformers and serving stacks may read only
rope_scaling. Losing YaRN metadata makes a long-context draft silently fall back to unscaled RoPE and can collapse acceptance beyond the original context.The original fix lived in the removed legacy DSpark trainer. This PR moves the safeguard to the current export boundary, where runtime checkpoints become loadable model directories.
Impact
Exported long-context drafts remain readable across current and legacy consumers without changing default-RoPE checkpoints.
Validation
python -m unittest tests.test_runtime.test_export.TestRoPEConfigCompatibilitypre-commit run --files specforge/export/checkpoint_io.py specforge/export/to_hf.py specforge/export/to_sglang.py tests/test_runtime/test_export.pygit diff --check upstream/main...HEADThe existing GPU exporter round-trip suite was also launched in this CUDA-enabled checkout; the focused compatibility tests above are the deterministic coverage added by this PR.