改动 / #3393
#3393 [Other] setup: reject invalid explicit RoPE scale factors
open · @j-luwierski · 0 评论 · 去 GitHub 看
Setup & installModels & quantsLinux
说明
## Problem and result
On current `main`, setup accepts an explicit `--rope-scale` of `nan`, `inf`, `-inf`, zero, or a value below 1. For example, `resolve_rope(1048576, "yarn", float("nan"))` returns `("yarn", nan)`; setup can then pass the invalid value into the generated engine arguments. The engine requires a finite factor >= 1.
After this change, setup rejects every explicit non-finite factor and every factor below 1 before it writes configuration, and the error names `--rope-scale` and the valid range. Valid factors remain unchanged.
## Related discussion
This is the rebased follow-up to #2950, which was closed during the 0.2.0-beta tracker reset rather than declined. Its fix was not present on current `main`.
## Approach
Validate the explicit factor at the start of `resolve_rope()` with `math.isfinite()` and the engine's >= 1 lower bound. Update `--help` to state the accepted range. Add regression coverage across contexts below, at and above 262144, with omitted, `none`, `linear` and `yarn` scaling methods.
Automatic scaling, valid explicit overrides, model inference and backend code are unchanged. This does not change YaRN quality or require the factor to cover the requested context.
## Validation
Revision: `b7c8ede5`, based on `main` `5bda973a`. Linux, Python 3; no GPU or model downloads.
**Passed:**
- Reproduced on unmodified `5bda973a`: the resolver accepted NaN, both infinities, -1, 0 and 0.5 for contexts 131072, 262144 and 1048576 with linear and yarn.
- `python3 -m unittest tools.test_setup_rope tools.test_setup_choices tools.test_setup_configs tools.test_setup_config -q`: 93 tests pass.
- `python3 setup.py --help`: help shows the finite and >= 1 constraint.
- `git diff --check`.
**Failed:** none.
**Not run:** GPU builds and model inference; no engine/backend source or build files changed. The test run emitted existing `/proc/cpuinfo` ResourceWarnings and a read-only fixture note; all 93 tests passed.
## Limits
Validation covers setup's resolver and its configuration tests. It does not measure model behavior or the quality of RoPE scaling.本站相关内容
相关页面的快捷入口。