Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorrt_edgellm/checkpoint/checkpoint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def normalize_rope_scaling_for_runtime(rope_scaling: Any) -> Any:
normalized = dict(rope_scaling)
if "mrope_section" in normalized:
rope_type = normalized.get("type") or normalized.get("rope_type")
if rope_type in (None, "default", "mrope"):
if rope_type in (None, "default", "linear", "mrope"):
normalized["type"] = "default"
normalized["rope_type"] = "default"
# rope_parameters (transformers v5) carries "rope_type" without "type";
Expand Down
37 changes: 35 additions & 2 deletions tests/python-unittests/test_checkpoint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
sys.path.insert(0, _REPO_ROOT)

try:
from tensorrt_edgellm.checkpoint.checkpoint_utils import \
load_checkpoint_config_dicts
from tensorrt_edgellm.checkpoint.checkpoint_utils import (
load_checkpoint_config_dicts, normalize_rope_scaling_for_runtime)
except ImportError as exc: # pragma: no cover
pytest.skip(f"tensorrt_edgellm not importable: {exc}",
allow_module_level=True)
Expand Down Expand Up @@ -95,6 +95,39 @@ def _assert_kmrope(rope_scaling):
f"for kMRope; got {rope_type!r}")


def test_linear_rope_with_mrope_section_is_normalized_for_runtime():
"""Qwen3-ASR uses linear scaling metadata for an MRoPE configuration."""
source = {
"factor": 1.0,
"mrope_section": [24, 20, 20],
"rope_type": "linear",
}

normalized = normalize_rope_scaling_for_runtime(source)

assert normalized == {
"factor": 1.0,
"mrope_section": [24, 20, 20],
"rope_type": "default",
"type": "default",
}
assert source["rope_type"] == "linear"


def test_linear_rope_without_mrope_section_keeps_linear_semantics():
"""Ordinary linear RoPE must not be classified as MRoPE."""
normalized = normalize_rope_scaling_for_runtime({
"factor": 2.0,
"rope_type": "linear",
})

assert normalized == {
"factor": 2.0,
"rope_type": "linear",
"type": "linear",
}


def test_qwen3_vl_transformers_v5_recovers_rope_from_text_config_rope_parameters(
):
"""The bug that caused MR !761 VLM CI failures: transformers-v5 puts the
Expand Down