Repository navigation
Description
System Info
Transformers 5.19.0.dev0, unmodified main at ea9259355388f518240f96a8c2dee7311b1c5911 (the same setter remains on current main at 3b829407e8bd56f7f4c7950f1226579d23b50db7).
Linux 6.8.0-137-generic x86_64, glibc 2.39; Python 3.12.15; PyTorch 2.14.1+cpu.
No model weights or GPU are needed.
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
Assigning the v4-style rope_scaling alias to an initialized config replaces rope_parameters, dropping the existing rope_theta and other base parameters (setter).
The CPU-only example below starts with a base of 500000 and raises KeyError: 'rope_type' after the assignment; using the canonical rope_type key also loses the base.
from transformers import LlamaConfig
from transformers.models.llama.modeling_llama import LlamaRotaryEmbedding
config = LlamaConfig(rope_theta=500000.0)
config.rope_scaling = {"type": "linear", "factor": 2.0}
print(config.rope_parameters)
LlamaRotaryEmbedding(config)Output from the unmodified revision:
{'type': 'linear', 'factor': 2.0}
Traceback (most recent call last):
File "report-repro.py", line 28, in <module>
LlamaRotaryEmbedding(config)
File "src/transformers/models/llama/modeling_llama.py", line 80, in __init__
self.rope_type = self.config.rope_parameters["rope_type"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'rope_type'
Saving and reloading that assigned config restores the constructor default base of 10000 instead of the original 500000.
This also affects real downstream overrides: sgl-project/sglang#41227 reports a 500000 → 10000 fallback and a GSM8K result change from 161 to 106 on the first 200 examples; the review of sgl-project/sglang#43067 confirms that the affected override is used in documented long-context recipes.
Expected behavior
The setter should normalize legacy parameter names and preserve existing base parameters unless the assignment explicitly overrides them.
PR #49515 provides a fix: ten new regressions fail on the unmodified revision, all 45 RoPE tests pass with the fix, and the current PR CI has no failed checks.
Activity
github-actions commentedon Nov 12, 2026
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Rocketknight1 commentedon Nov 12, 2026
cc @zucchini-nlp for RoPE
zucchini-nlp commentedon Nov 13, 2026
the linked PR was merged, closing as resolved