TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

[Bug]: Gemma4 HF NVFP4 export cannot be loaded by TRT-LLM builtin runtime on DGX Spark/GB10 (tokenizer/runtime skew)

Open DrHepa opened this issue 7 months ago • 5 comments

System Info

  • CPU architecture: aarch64
  • Host memory: 121 GiB RAM
  • GPU: NVIDIA GB10 (DGX Spark)
  • Driver: 580.142
  • OS: Linux

Export line:

  • Container: nvcr.io/nvidia/tensorrt-llm/release:1.2.0
  • Container digest: sha256:4c120954694e33e9d1bd206b422728f53e65df0d1e9718656de33a995a09c457
  • tensorrt_llm: 1.2.0
  • nvidia-modelopt: 0.37.0
  • Export overlay for HF/model side: transformers==5.5.0
  • Model: google/gemma-4-31b-it
  • Export type: HF NVFP4

Runtime line under test:

  • Same TRT-LLM builtin container/runtime (1.2.0)
  • Builtin transformers: 4.57.3

Who can help?

@Tracin @Fridah-nv

Information

  • [x] The official example scripts
  • [x] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [x] My own task or dataset (give details below)

Reproduction

We can reproduce this on DGX Spark / GB10 with a Gemma4 multimodal HF NVFP4 export.

  1. Produce an HF NVFP4 export of google/gemma-4-31b-it using ModelOpt 0.37.0.

    • In our case, the export itself required a local backport for the _amax export issue to complete.
    • Final export run reference: experiments/gemma-4-31b-it/quantization/20260404T222137Z/
  2. The exported package contains at least:

    • config.json
    • hf_quant_config.json
    • tokenizer.json
    • tokenizer_config.json
    • weight file(s)
  3. Validate with the builtin TRT-LLM runtime path used by ModelOpt examples:

    • examples/llm_ptq/run_tensorrt_llm.py
    • which internally calls AutoTokenizer.from_pretrained(...)

Observed failures:

Failure A — original exported tokenizer config with builtin runtime

Builtin TRT-LLM runtime fails immediately in the Gemma tokenizer path:

AttributeError: list object has no attribute keys

Stack points to:

  • transformers/models/gemma/tokenization_gemma_fast.py
  • transformers/tokenization_utils_base.py

Relevant detail from exported tokenizer_config.json:

  • extra_special_tokens is serialized as a list

Failure B — sanitized tokenizer config (diagnostic only)

We created a non-destructive sanitized copy only for diagnosis, normalizing extra_special_tokens from list to mapping. This gets us past Failure A, but builtin runtime then fails later with:

ValueError: The checkpoint you are trying to load has model type `gemma4` but Transformers does not recognize this architecture.

Failure C — force transformers==5.5.0 inside same container/runtime

If we force transformers==5.5.0 inside the builtin TRT-LLM container, TRT-LLM itself breaks on import:

ImportError: cannot import name AutoModelForVision2Seq from transformers

So the situation is:

  • export side needs a newer Transformers surface for Gemma4
  • builtin TRT-LLM runtime stays on an older/incompatible one
  • forcing the newer one breaks TRT-LLM imports

Expected behavior

A completed HF NVFP4 export of google/gemma-4-31b-it should be loadable by the builtin TRT-LLM runtime path used by the ModelOpt validation flow, at least for tokenizer initialization and minimal runtime setup.

actual behavior

The export completes, but builtin TRT-LLM runtime cannot consume it:

  • original tokenizer config fails with extra_special_tokens list handling
  • sanitized config gets farther but then fails because gemma4 is not recognized by the builtin Transformers surface
  • upgrading builtin Transformers to match export semantics breaks TRT-LLM imports (AutoModelForVision2Seq)

additional notes

  • This is a different issue from our already-opened TRT-LLM runtime bug for Qwen3 NVFP4:
    • NVIDIA/TensorRT-LLM#12762
  • For Gemma4, the export itself is now real and complete; the blocker is runtime/tokenizer compatibility.
  • Validation evidence lives in:
    • validation_summary.json
    • builtin_trtllm.stderr.log
    • builtin_trtllm_sanitized.stderr.log
    • builtin_trtllm_transformers_5_5_0.stderr.log
  • I searched for duplicates around Gemma4/tokenizer/extra_special_tokens/model_type in TRT-LLM and did not find a matching open bug.

Before submitting a new issue...

  • [x] Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.

DrHepa avatar Apr 04 '26 23:04 DrHepa

Could we download this nvfp4 version https://huggingface.co/nvidia/Gemma-4-31B-IT-NVFP4 directly?

nv-guomingz avatar Apr 05 '26 11:04 nv-guomingz

Gemma 4 support is coming?

jhirschibar avatar Apr 13 '26 14:04 jhirschibar

Gemma 4

phocopad avatar Apr 13 '26 18:04 phocopad

Gemma 4 can be found in Supported Models table, but only via the AutoDeploy, and text-only :)

karljang avatar May 05 '26 04:05 karljang

Gemma 4 is now supported on the latest main.

Hudayday avatar May 09 '26 13:05 Hudayday