Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with 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
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, machine-learning
Hướng nghiên cứu
Đọc tensorrt_llm/_torch/models/modeling_gpt_oss.py quanh các dòng 605–617, nơi ánh xạ cấu hình truy cập các trường GPT-OSS cũ. Kiểm tra cách HuggingFace GptOssConfig biểu diễn rope_scaling và số lượng chuyên gia, sau đó chạy quy trình tái hiện đã được báo cáo với python3 -m dynamo.trtllm, openai/gpt-oss-120b và tensor parallelism bằng 2. Hoàn thành khi các cấu hình HuggingFace tiêu chuẩn được tải mà không gặp AttributeError và ánh xạ cấu hình cũ vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
Loading standard HuggingFace openai/gpt-oss-120b with transformers>=5.x (tested on transformers==5.10.4 with tensorrt_llm==1.4.0rc2 in nvcr.io/nvidia/ai-dynamo/tensorrtllm-runtime:1.7.0, and verified still present on main) fails during GptOssForCausalLM.__init__ with:
File ".../tensorrt_llm/_torch/models/modeling_gpt_oss.py", line 611, in __init__
model_config.pretrained_config.rope_scaling_factor,
AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor'
Root Cause
In tensorrt_llm/_torch/models/modeling_gpt_oss.py (lines 605–617 on main):
# Map config to HF format.
if hasattr(model_config.pretrained_config, 'num_experts'):
model_config.pretrained_config.num_local_experts = model_config.pretrained_config.num_experts
model_config.pretrained_config.num_experts_per_tok = model_config.pretrained_config.experts_per_token
model_config.pretrained_config.rope_scaling = {
'factor':
model_config.pretrained_config.rope_scaling_factor,
'beta_fast':
model_config.pretrained_config.rope_ntk_beta,
'beta_slow':
model_config.pretrained_config.rope_ntk_alpha,
'original_max_position_embeddings':
model_config.pretrained_config.initial_context_length,
}
The guard hasattr(model_config.pretrained_config, 'num_experts') assumes that only legacy non-HF OpenAI GPT-OSS configs expose num_experts. However, in newer HuggingFace transformers (5.10.4), standard GptOssConfig exposes num_experts alongside standard HF num_local_experts, num_experts_per_tok, and rope_scaling (dict)—without experts_per_token or rope_scaling_factor.
Minimal Reproduction
Inside nvcr.io/nvidia/ai-dynamo/tensorrtllm-runtime:1.7.0 (transformers==5.10.4, tensorrt_llm==1.4.0rc2):
from transformers import GptOssConfig
c = GptOssConfig()
print(hasattr(c, "num_experts")) # True (128)
print(hasattr(c, "num_local_experts")) # True (128)
print(hasattr(c, "rope_scaling")) # True ({'rope_type': 'yarn', 'factor': 32.0, ...})
print(hasattr(c, "rope_scaling_factor")) # False -> triggers AttributeError at modeling_gpt_oss.py:611
Running python3 -m dynamo.trtllm --model-path <openai/gpt-oss-120b> --tensor-parallel-size 2 crashes during AutoModelForCausalLM.from_config(...) with the traceback above.
Proposed Fix
Guard the legacy non-HF config mapping so it only runs when rope_scaling_factor (and experts_per_token) are actually present:
if (
hasattr(model_config.pretrained_config, 'num_experts')
and hasattr(model_config.pretrained_config, 'rope_scaling_factor')
):
Verification
Verified on 2× NVIDIA H100 80GB HBM3 (nvcr.io/nvidia/ai-dynamo/tensorrtllm-runtime:1.7.0, openai/gpt-oss-120b, TP=2): applying this guard eliminates the AttributeError, allowing GptOssForCausalLM.__init__, weight loading, intra-node TP group init, and KVCM2 initialization to succeed cleanly.
- 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
-
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
-
[Bug]: AutoTuner load_cache crashes on a non-string tactic entry: warning_once(key=<list>) raises TypeError: unhashable typeCó thể đã có người làm @Gloria72 đã nhận 36 ngày trước. Đang mởCustomized kernels
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/TensorRT-LLM#21218 · 2 bình luận ·
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ự
-
[Resource]: SpaicelyĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
hesreallyhim/awesome-claude-code#3875 · 1 bình luận ·
-
[Bug]: Ajax Pro login issueĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
bvis/aegis-hass#725 ·
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 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainer thường phản hồi trong vòng 1 ngày