Text Generation
Transformers
Safetensors
PyTorch
nemotron_h
nvidia
conversational
custom_code
Eval Results

Remove auto_map — use native transformers NemotronH implementation

#69

Summary

Removes the auto_map field from config.json so that transformers >= 5.0 uses its native NemotronH implementation instead of the custom modeling_nemotron_h.py files.

Why

The custom modeling code has multiple bugs that break inference on current transformers:

  1. key_cache property conflictDynamicCache.key_cache became read-only in transformers 4.55+. Custom code raises AttributeError: property has no setter. (discussion #14, discussion #65)

  2. KV cache not passed to attention layerspast_key_values from generate() never mapped to cache_params. (discussion #65)

  3. conv_states.device / ssm_states.device — Lists, not tensors. .device raises AttributeError.

  4. conv_kernel_size not instance attribute on cache class.

  5. conv_state wrong dimension (9B-v2) — Uses intermediate_size instead of conv_dim.

The native transformers implementation handles all of these correctly and supports Flash Attention 2, SDPA, and flex attention.

What Changed

  • Removed auto_map from config.json only
  • Custom .py files remain for backward compatibility

Compatibility

  • transformers >= 5.0: Uses native implementation (no trust_remote_code needed)
  • transformers < 5.0: Falls back to custom code (already broken on 4.55+, no regression)

Verification

Tested on GB10 GPU (sm_121, CUDA 13.0, transformers 5.16.0.dev0): model loads and generates correctly without trust_remote_code, HumanEval runs at 94% GPU utilization.

Publish this branch
This branch is in draft mode, publish it to be able to merge.

Sign up or log in to comment