[Bug]: Gemma 3 global layers run without their linear RoPE scaling (factor 8) on transformers 5.x
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 15.2k
- Fork
- 3k
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 477
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xCó thể đã có người làm @NimaVaziri đã nhận hôm nay. Đang mởPytorch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Inference runtime Windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: MMLU subsampling changes when evaluators are interleavedCó thể đã có người làm @LeNeLeNeWo đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderCó thể đã có người làm @sbeierle đã nhận 3 ngày trước. Đang mởTesting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LongBench V2 blog command breaks on inline comments after continuationsCó thể đã có người làm @ddlw đã nhận 25 ngày trước. Đang mởDoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NVIDIA/TensorRT-LLM
Issue tương tự
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorCó thể đã có người làm @jejjohnson đã nhận hôm nay. Đang mởtype:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
jejjohnson/integrix#144 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
finos/ai-governance-framework#459 ·
-
slurm: a case outcome nested too deep crashes status/collect instead of reading as no outcomeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
freelawproject/litigant-portal#1307 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainer thường phản hồi trong vòng 1 ngày