Skip to content

DTensor v2 fails to load Nemotron-H checkpoints (backbone.embedding vs backbone.embeddings) #4211

Description

@yuki-97

The tiny_nemotron5_h training setups in tests/unit/models/policy/test_dtensor_worker.py::TestTwoGPUCluster::test_dtensor_worker_training fail under DTensor v2 when loading the HF checkpoint:

RuntimeError: Missing key in checkpoint state_dict: backbone.embeddings.weight

The model built by AutoModel names the embedding backbone.embeddings.weight (plural), while the checkpoint produced by transformers' NemotronHForCausalLM uses backbone.embedding.weight (singular). All 25 other keys match.

nemo_automodel/components/models/nemotron_v3/state_dict_adapter.py:132 only maps backbone.embed_tokens.weight -> backbone.embeddings.weight; nothing handles the singular spelling.

Note that the underlying error is masked in CI by TypeError: cannot pickle code objects -- _DistWrapper.reduce_scatter gathers the exception object, whose traceback frames hold code objects.

These two setups are disabled in the test until this is fixed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions