[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
+9
View File
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import math
import os
from collections.abc import Callable, Iterator, Sequence
from contextlib import contextmanager
@@ -539,6 +540,14 @@ def patch_legacy_rope_type(rope_parameters: dict[str, Any] | None) -> None:
)
rope_parameters["rope_type"] = "default"
logger.warning("Replacing legacy rope_type 'mrope' with 'default'")
elif rope_parameters["rope_type"] == "telechat3-yarn":
# TeleChat3 is YaRN with 0.07 in place of YaRN's 0.1 attention
# scaling coefficient. Precompute it so the config is plain YaRN.
factor = rope_parameters["factor"]
rope_parameters["rope_type"] = "yarn"
rope_parameters["attention_factor"] = 0.07 * math.log(factor) + 1.0
rope_parameters.pop("type", None)
logger.warning("Replacing rope_type 'telechat3-yarn' with 'yarn'")
# Handle nested rope_parameters in interleaved sliding attention models
if is_rope_parameters_nested(rope_parameters):