[PR #3393] [CLOSED] [Other] setup: reject invalid explicit RoPE scale factors #4612

Closed
opened 2026-11-07 15:37:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3393
Author: @j-luwierski
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: codex/reject-invalid-rope-scale


📝 Commits (1)

  • b7c8ede [Other] reject invalid explicit RoPE scales

📊 Changes

2 files changed (+20 additions, -3 deletions)

View changed files

📝 setup.py (+5 -3)
📝 tools/test_setup_rope.py (+15 -0)

📄 Description

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.

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3393 **Author:** [@j-luwierski](https://github.com/j-luwierski) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/reject-invalid-rope-scale` --- ### 📝 Commits (1) - [`b7c8ede`](https://github.com/Niko1221/Strata/commit/b7c8ede5b2215926a8b8459bb14412afa2624879) [Other] reject invalid explicit RoPE scales ### 📊 Changes **2 files changed** (+20 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+5 -3) 📝 `tools/test_setup_rope.py` (+15 -0) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:37:49 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4612
No description provided.