[Bugfix] Align vLLM YaRN with Transformers and stop re-scaling max_model_len (#56446)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-11 13:01:38 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent a5b714eee4
commit c191787a68
11 changed files with 133 additions and 134 deletions
+26
View File
@@ -6,6 +6,7 @@ only get the `eos_token_id` from the tokenizer as defined by
`BaseRenderer.get_eos_token_id`.
"""
import math
from types import SimpleNamespace
from typing import cast
from unittest.mock import MagicMock, patch
@@ -52,6 +53,31 @@ def test_patch_legacy_rope_type_preserves_nope_layers():
}
def test_patch_legacy_rope_type_normalizes_telechat3_yarn():
"""TeleChat3's RoPE is YaRN with 0.07 in place of the usual 0.1.
Encoding that as a precomputed attention_factor keeps the config
plain YaRN, which Transformers and every "yarn" guard understand.
`mscale` cannot express it: Transformers only applies mscale when
mscale_all_dim is also truthy.
"""
rope_parameters = {
"type": "telechat3-yarn",
"rope_type": "telechat3-yarn",
"factor": 4.0,
"original_max_position_embeddings": 8192,
}
patch_legacy_rope_type(rope_parameters)
assert rope_parameters == {
"rope_type": "yarn",
"factor": 4.0,
"original_max_position_embeddings": 8192,
"attention_factor": pytest.approx(0.07 * math.log(4.0) + 1.0),
}
def test_glm5_next_accepts_deepseek_sparse_attention_layers():
layer_types = ["linear_attention", "deepseek_sparse_attention"]