[Bug]: Gemma 3 global layers run without their linear RoPE scaling (factor 8) on transformers 5.x
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
調査の方向性
Read RopeParams.from_config and the TestFromConfigPerLayerType regression test in tests/unittest/_torch/attention/test_rotary_embedding.py. Reproduce the reported CPU only case with transformers 5.5.4 and check that the normalized full_attention parameters yield 1000000.0 linear 8.0; completion is a regression test that catches the reported none and 1.0 result. An open linked pull request already addresses this issue.
索引モデルが issue の本文から書いたものです。
説明
System Info
TensorRT-LLM main (3f692ac), PyTorch backend, transformers 5.5.4 (the version in requirements.txt). The config path is CPU-only, so no GPU is needed to reproduce it.
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Reproduction
On transformers 5.x, PretrainedConfig.rope_scaling is an alias of rope_parameters. For Gemma 3 that is a dict keyed by layer type:
from transformers import Gemma3TextConfig
from tensorrt_llm._torch.attention.backends.interface import RopeParams
# text_config of google/gemma-3-4b-it (same scaling in 12B and 27B)
cfg = Gemma3TextConfig(hidden_size=2560, num_attention_heads=8, num_key_value_heads=4,
head_dim=256, num_hidden_layers=34, max_position_embeddings=131072,
rope_theta=1e6, rope_local_base_freq=1e4,
rope_scaling={"rope_type": "linear", "factor": 8.0})
print(cfg.rope_scaling)
# {'sliding_attention': {'rope_type': 'default', 'rope_theta': 10000.0},
# 'full_attention': {'rope_type': 'linear', 'factor': 8.0, 'rope_theta': 1000000.0}}
rp = RopeParams.from_config(cfg)
print(rp.theta, rp.scale_type.name, rp.scale)
Expected behavior
1000000.0 linear 8.0. HF's Gemma3RotaryEmbedding divides the full-attention inv_freq by 8.
actual behavior
1000000.0 none 1.0.
Gemma3Attention builds every global (full-attention) layer from this RopeParams, so Gemma 3 4B/12B/27B (and fine-tunes such as MedGemma) run their global layers with RoPE angles 8x too large at every position. Sliding layers are not affected, because they override theta and scaling. The existing GPU test test_gemma3_allclose_to_hf[27B] does not catch this: it uses 8 tokens, atol=0.4, and a "most elements close" check, with a single global layer.
additional notes
Root cause: in RopeParams.from_config, from_config correctly picks rope_parameters["full_attention"] into normalized_rope_parameters. But it then reads scaling from getattr(config, "rope_scaling"). That is the outer per-layer-type dict, which is not None, so the fallback to the normalized entry never runs. rope_type and factor are both missing from the outer dict, so the scaling becomes none with a factor of 1.0.
Fix: when rope_scaling is None or is the per-layer-type rope_parameters itself, use the normalized entry. A fix with a CPU-only regression test (TestFromConfigPerLayerType in tests/unittest/_torch/attention/test_rotary_embedding.py) follows in a PR.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
- 主要言語
- Python
- スター
- 15.2k
- フォーク
- 3k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 477
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/TensorRT-LLM のほかの issue
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.x対応中かも @NimaVaziri が今日担当しました。 オープンPytorch
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/TensorRT-LLM#23406 ·
メンテナーはふだん 1 日以内に返信
-
Inference runtime Windows
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NVIDIA/TensorRT-LLM#23394 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: MMLU subsampling changes when evaluators are interleaved対応中かも @LeNeLeNeWo が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NVIDIA/TensorRT-LLM#23273 ·
メンテナーはふだん 1 日以内に返信
-
Trace-replay Pareto window includes the drain when sessions finish out of admission order対応中かも @sbeierle が 3 日前に担当しました。 オープンTesting
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
NVIDIA/TensorRT-LLM#23077 ·
メンテナーはふだん 1 日以内に返信
-
LongBench V2 blog command breaks on inline comments after continuations対応中かも @ddlw が 25 日前に担当しました。 オープンDoc
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
NVIDIA/TensorRT-LLM#21879 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/TensorRT-LLM の issue をすべて見る
似ている issue
-
[Resource]: Spaicelyオープンresource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
hesreallyhim/awesome-claude-code#3875 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
bvis/aegis-hass#725 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
メンテナーはふだん 1 日以内に返信