Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.x
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
設定マッピングが古いGPT-OSSフィールドにアクセスしている tensorrt_llm/_torch/models/modeling_gpt_oss.py の605〜617行付近を読んでください。HuggingFace GptOssConfig が rope_scaling とエキスパート数をどのように表現しているかを確認し、報告された再現手順を python3 -m dynamo.trtllm、openai/gpt-oss-120b、テンソル並列数2で実行してください。標準的なHuggingFace設定が AttributeError なしで読み込まれ、古い設定マッピングも引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 15.2k
- フォーク
- 3k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 477
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/TensorRT-LLM のほかの issue
-
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 日以内に返信
-
[Bug]: AutoTuner load_cache crashes on a non-string tactic entry: warning_once(key=<list>) raises TypeError: unhashable type対応中かも @Gloria72 が 36 日前に担当しました。 オープンCustomized kernels
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/TensorRT-LLM#21218 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/TensorRT-LLM の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
daniel-ospina/tortoise#15308 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
difficulty:easy prio:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NatronGitHub/Natron#2405 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Jstar269/nakagawa-recomp#3746 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信