Pull requests / #2950
#2950 fix(setup): reject invalid RoPE scaling factors
open · @j-luwierski · 0 comments · View on GitHub
Setup & installAMD / HIPNVIDIA / CUDAModels & quantsLinux
Description
## Summary Setup's `resolve_rope()` accepts an explicit `--rope-scale nan`, `inf`, or a value below 1 and forwards it into the saved engine arguments. The engine rejects these values: `rope_scaling_invalid()` requires a finite factor >= 1. Reject invalid explicit factors during setup's RoPE resolution, before configuration is saved, with a message naming the flag and its valid range. ## What changed - `setup.py`: validate explicit factors using `math.isfinite()` and the engine's >= 1 lower bound; document the range in `--help`. - `tools/test_setup_rope.py`: cover NaN, both infinities, negative, zero and fractional factors below 1 across contexts below, at and above 262144, with omitted/none/linear/yarn methods. Confirm valid explicit factors remain unchanged, including factors smaller than the context-derived ratio. Automatic scaling, valid explicit overrides, model inference and backend code are unchanged. This does not change YaRN quality or enforce a context-covering factor. ## Validation Based on upstream `477ac13cbe8e582c20484871ce459d20d82df09d`, Linux, Python 3; no GPU or model downloads. - The new invalid-factor regression fails against the original resolver (72 failing subcases) and passes with this change. - `python3 -m unittest tools.test_setup_rope tools.test_setup_choices tools.test_setup_configs tools.test_setup_config -q`: **89 tests pass**. - Compared original and changed setup over all 5 golden hardware profiles x 5 model selections x 2 answer modes (`--yes` and Enter): **50/50 comparisons match** for exit code, normalized serialized configuration and questions. - Adding `tools.test_setup_golden` runs 93 tests with 8 Unsloth golden subcase failures. The same 8 subcases fail with the original upstream setup; golden files were not regenerated. - `git diff --check` passes. No CUDA/HIP/SYCL source or build file changes; backend builds and on-model inference were not run. ## Related work Searched open issues/PRs for `rope-scale`, `resolve_rope`, RoPE validation and non-finite factors; no matching setup-validation fix found. Existing cache migration (#1698) and Metal RoPE support (#2819) address separate behavior.
Related on this site
Quick links to related pages.