[Bugfix] Keep rope_theta when --json-model-override-args overrides rope_scaling (#43067)

Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
Jin
2026-10-14 10:16:35 +08:00
committed by GitHub
co-authored by Xinyuan Tong
parent 536d065370
commit 44b44774c3
2 changed files with 57 additions and 0 deletions
@@ -384,6 +384,14 @@ def get_config(
current = getattr(config, key, None)
if isinstance(value, dict) and isinstance(current, PretrainedConfig):
current.update(value)
elif (
key in ("rope_scaling", "rope_parameters")
and isinstance(value, dict)
and isinstance(current, dict)
):
# v5's rope_scaling setter replaces rope_parameters wholesale;
# merge so partial overrides keep rope_theta (#41227).
setattr(config, key, {**current, **value})
else:
setattr(config, key, value)