Skip to content

fix(customizer): grpo sft full serialization fix - #1868

Draft
soluwalana wants to merge 11 commits into
release/0.5from
nvbug-6740834/solu
Draft

fix(customizer): grpo sft full serialization fix#1868
soluwalana wants to merge 11 commits into
release/0.5from
nvbug-6740834/solu

Conversation

@soluwalana

@soluwalana soluwalana commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

A successful one-step GRPO all_weights run with policy_backend=automodel already writes HuggingFace safetensors (policy/weights/model/shard-*.safetensors). Publication always sent that tree to NeMo-RL's DCP converter, which requires a .metadata file and failed with FileNotFoundError from convert_dcp_to_hf. Users never got a registered model or fileset from a completed full-weight GRPO job.

After this change, Automodel full-weight checkpoints are copied (preferring model/consolidated/) and only DTensor V1 DCP trees still go through convert_dcp_to_hf.

Related Issue

NVBug 6740834. QA cross-check: DevTest T6259695 / job rl-14f91222c14d (also tracked against 6716627).

Changes

  • Detect an already-HuggingFace full-weight tree (find_hf_full_weight_root) and copy it for publication: flatten .hf_metadata (config.json, tokenizer), attach policy/tokenizer when needed, strip the FSDP2 architecture prefix, and leave optimizer state behind.
  • Rename a single-rank, single-file Automodel shard (shard-00001-model-00001-of-00001.safetensors) to model.safetensors so HuggingFace/from_pretrained and fileset checks accept it. Multi-rank or multi-file shard layouts are left as-is with a warning — those need Automodel consolidation, not a rename.
  • Keep DCP conversion only when .metadata is present (DTensor V1). Fail with an explicit path if neither an HF tree nor DCP metadata exists.
  • For Automodel all_weights GRPO, emit checkpointing.model_save_format=safetensors and save_consolidated=every so training writes model/consolidated/ when the pinned Automodel honors it. The string "every" is used instead of True/"final": NeMo-RL setattrs this past Automodel's bool→enum normalizer, and it never passes is_final_checkpoint. Omit both keys for DTensor V1 (V1 rejects model_save_format) and for LoRA.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: Publication bugfix only; no API, CLI, or user-facing docs change.

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Targeted validation:

.venv/bin/pytest services/rl/tests/test_checkpoints.py services/rl/tests/test_grpo_config.py -q

95 passed.

uv run pre-commit run -a was not run on this branch.

Verified that one step run fixed the HF export.

2026-09-08 23:22:25,692 - nmp.rl.tasks.training.backends.nemo_rl.backend - INFO - Processing created checkpoint
2026-09-08 23:22:25,693 - nmp.rl.tasks.training.backends.nemo_rl.backend - INFO - Copying HuggingFace full-weight checkpoint from /var/run/scratch/job/training/checkpoints/step_1/policy/weights/model/consolidated to /var/run/scratch/job/output_model
2026-09-08 23:22:27,326 - nmp.rl.tasks.training.backends.nemo_rl.checkpoints - INFO - Copying tokenizer from /var/run/scratch/job/training/checkpoints/step_1/policy/tokenizer to /var/run/scratch/job/output_model
2026-09-08 23:22:27,338 - nmp.rl.tasks.training.chat_templates - INFO - Applied chat template to output checkpoint
2026-09-08 23:22:27,694 - httpx - INFO - HTTP Request: PUT http://nemo-platform-api:8080/apis/jobs/v2/workspaces/default/jobs/rl-a453b2521a17/steps/grpo-training/tasks/task-d58fc6d0-a61c-4775-88b9-6dcf46ae5c9d "HTTP/1.1 200 OK"
2026-09-08 23:22:27,695 - nmp.rl.tasks.training.runner - INFO - Result written to: /var/run/scratch/job/training/rl_training_result.json

Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
@github-actions github-actions Bot added the fix label Sep 8, 2026
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 35562/45376 78.4% 62.9%
Integration Tests 21162/43151 49.0% 22.3%

Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Signed-off-by: Sam Oluwalana <soluwalana@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant