serve: --rope-scaling writes static YaRN over a container's own rotary keys

yarn:FACTOR[:ORIG] (or none) is written at load into the rotary object yarn_from takes first --
for a Qwen3.8 container text_config.rope_parameters, which already says default, so YaRN written
beside it would never be read -- and resolved and checked exactly as a converted container's is.
An existing container serves past its trained context with no reconvert; a DFlash2 drafter gets
the same factor over its own trained length; a checkpoint's own YaRN has its factor replaced and
its stale attention_factor/mscale dropped; linear or other explicit types are refused. Startup
names the rotary's reach and warns when --max-model-len is past it, and a persisted prefix cache
written under another --rope-scaling is not reused. core/format/rope_override.h is held to
yarn_from in tests/yarn_test.cpp.
This commit is contained in:
baKon authored and Deadcode committed 2026-10-07 11:13:46 +02:00
1 parent ee5fcf1024
commit 6fa7707dff
9 files changed
+457 -1

No files matched your search

+18
View File
@@ -825,3 +825,21 @@ TEST(usage_names_every_flag_it_documents) {
}
RAD_TEST_MAIN()
/* --rope-scaling is checked at the command line: a typo is a refusal, not a model served with its
* trained rotary at a length it cannot reach. */
TEST(rope_scaling_takes_yarn_with_a_factor_above_one_or_none) {
for (const char* ok : { "yarn:4", "yarn:2.5", "yarn:4:262144", "none" }) {
Config c;
CHECK_EQ(parse({ "--rope-scaling", ok }, &c), RAD_OK);
CHECK_EQ(c.rope_scaling, std::string(ok));
}
for (const char* bad : { "yarn:1", "yarn:0.5", "yarn:4x", "yarn:", "yarn:4:", "yarn:4:0",
"yarn:4:12k", "linear:2", "yarn" }) {
Config c;
CHECK(parse({ "--rope-scaling", bad }, &c) < 0);
}
Config d;
CHECK_EQ(parse({}, &d), RAD_OK);
CHECK(d.rope_scaling.empty());
}