Repository navigation
Description
Describe the bug
In NeMo-RL v0.7.0, exporting a consolidated Hugging Face checkpoint for google/gemma-4-31B-it with AutoModel, FSDP2, and DTensor v2 fails when consolidation takes longer than the Gloo process group's 30-minute default timeout.
With checkpointing.save_consolidated: true, ranks synchronize through dist.barrier() inside consolidate_safetensors_files_on_every_rank. In NFS-backed storage, gathering and writing the 31B checkpoint takes approximately 35–45 minutes. The Gloo process group times out after 30 minutes while rank 0 is still writing.
The failed job leaves truncated .safetensors files. These files cannot subsequently be loaded by Hugging Face Transformers, NeMo AutoModel, or SGLang.
This is a regression. The same model, hardware, topology, launch configuration, storage, and checkpoint complete successfully in approximately 43 minutes using the earlier NeMo-RL commit 37cb7de1a. The failure reproduces with NeMo-RL v0.7.0 and the intermediate nemo-rl-arm64.130 build.
Environment
- NeMo-RL failing version:
v0.7.0 - Additional failing build:
nemo-rl-arm64.130 - Last known working NeMo-RL commit:
37cb7de1a - Model:
google/gemma-4-31B-it - Model class:
Gemma4ForConditionalGeneration - Backend: NeMo AutoModel
- Distributed strategy: FSDP2 with DTensor v2
- Hardware: GB200
- Configurations tested:
- 32 GPUs: 8 workers × 4 GPUs
- 64 GPUs: 16 workers × 4 GPUs
- Parallelism: TP=1, CP=4
- CPU offload: enabled
- Distributed backend:
cuda:nccl,cpu:gloo - Model precision: BF16
- Storage: NFS-backed shared storage
- Python: 3.13
- Exact container image:
[ADD IMAGE AND TAG OR DIGEST] - PyTorch version:
[ADD VERSION] - Ray version:
[ADD VERSION]
Checkpoint configuration:
checkpointing:
save_optimizer: false
save_consolidated: trueSteps to reproduce
-
Configure Gemma 4 31B training using the NeMo AutoModel FSDP2/DTensor v2 backend.
-
Use a distributed configuration equivalent to:
tensor_parallel_size: 1
context_parallel_size: 4
cpu_offload: true
checkpointing:
save_optimizer: false
save_consolidated: true-
Run on 32 or 64 GB200 GPUs using shared storage where consolidation takes longer than 30 minutes.
-
Allow training to save, or explicitly consolidate, a checkpoint.
-
Observe non-writing ranks enter
dist.barrier()while rank 0 continues writing the Hugging Face safetensors. -
After 30 minutes, observe the Gloo timeout:
File ".../consolidate_hf_safetensors.py", line 855, in consolidate_safetensors_files_on_every_rank
dist.barrier()
File ".../torch/distributed/distributed_c10d.py", line 5037, in barrier
work.wait()
RuntimeError: [/pytorch/third_party/gloo/gloo/transport/tcp/unbound_buffer.cc:78]
Timed out waiting 1800000ms for recv operation to complete
- Attempt to load the generated checkpoint using Transformers, AutoModel, or SGLang.
The load fails because one of the safetensors files is incomplete.
Expected behavior
Consolidation should be allowed to run for the time required to export a large model.
The distributed timeout should be configurable and propagated to the process groups used by the checkpoint-consolidation path.
A failed consolidation must not leave truncated files that appear to be completed checkpoint artifacts.
Actual behavior
The consolidation is terminated at the default 30-minute Gloo timeout.
The generated index declares a total model size of approximately 125 GB, but the first output shard is short by approximately 0.5–6.6 GB, depending on the run. The second shard completes successfully.
Loading the incomplete shard produces an error similar to:
SafetensorError: Error while deserializing header:
incomplete metadata, file not fully covered
Working workaround
Setting a longer timeout on every Ray worker before NeMo-RL initializes the distributed process group allows consolidation to complete:
from datetime import timedelta
import torch.distributed as dist
_original_init_process_group = dist.init_process_group
def patched_init_process_group(*args, **kwargs):
if kwargs.get("timeout") is None:
kwargs["timeout"] = timedelta(hours=4)
return _original_init_process_group(*args, **kwargs)
dist.init_process_group = patched_init_process_groupWith a four-hour timeout, the affected v0.7.0 consolidation completes successfully in approximately 43 minutes. This indicates that the checkpoint contents and storage path are otherwise functional.
Suspected cause
NeMo-RL initializes the AutoModel process group without an explicit timeout:
torch.distributed.init_process_group(backend=backend)The CPU/Gloo group therefore uses PyTorch's 30-minute default. Large-model consolidation can legitimately exceed that timeout while other ranks wait at the post-write barrier.
The Python call appears unchanged between the working and failing builds. A bundled PyTorch, Gloo, Ray, or lower-level behavioral change may explain why the default timeout became observable in v0.7.0.
Activity
sharonyu-115 commentedon Aug 15, 2026
Hi @vikalluru, to trace down the reason of regression - "This is a regression. The same model, hardware, topology, launch configuration, storage, and checkpoint complete successfully in approximately 43 minutes using the earlier NeMo-RL commit 37cb7de. The failure reproduces with NeMo-RL v0.7.0 and the intermediate nemo-rl-arm64.130 build."
Would you help check in the training driver and worker logs of 0.7.0 and
37cb7de1a, whether both of them contain thedisabling async modemessage?something like:
stevenmsm commentedon Aug 18, 2026
@sharonyu-115 @vikalluru
The 37cb7de commit's log contains the following message:
"(DTensorPolicyWorkerV2 pid=3262, ip=10.241.35.126) ERROR:root:checkpointing.py:198: Async mode is only supported for torch >= 2.9.0, disabling async mode [repeated 31x across cluster]"
The issue from the 0.7.0 image is that: (a) I cannot use save_consolidate=True during training as when saving checkpoint, it will nccl timeout (worker died); (b) after finished training with save_consolidate=False, I want to consolidate the weights so I have to submit a separate job to just do save_consolidate without training, i.e. load the weights and consolidate, and it will fail. Let's mainly focus on the problem (b) above. I mainly observe two different errors.
sharonyu-115 commentedon Aug 20, 2026
Hi @stevenmsm, Thank you for the information. Here is the update after some further analysis:
We are upgrading the Automodel submodule to
r0.6.0in build(automodel): bump Automodel to r0.6.0 #3498. We verified that Automodel v0.6.0 gives consolidation its own Gloo group with aconsolidation_timeout_minutessetting on both the inline and async paths, a group-aware barrier, the index moved after the barrier. With that update, you will be enabled to specify aconsolidation_timeout_minutesvalue to avoid timeout, plusstaging_dirso even a failed consolidation can no longer publish a truncated shard. Here are the related Automodel side of PRs carrying the enhancements: fix(checkpoint): isolate consolidation timeout from NCCL Automodel#3108, feat(checkpoint): defer distributed async consolidation Automodel#3125. Will keep you posted on the status of build(automodel): bump Automodel to r0.6.0 #3498.For problem (b) you mentioned above, I see you are using your own customized script
consolidate_only.py, Automodel ships anoffline tool that does the disk-to-disk merge:
3rdparty/Automodel-workspace/Automodel/tools/offline_hf_consolidation.py. Have you tried if this script works for you?Besides, I'd like to confirm whether the
patched_init_process_groupworkaround mentioned above unblock you with usingsave_consolidate=True?stevenmsm commentedon Sep 1, 2026
Hi @sharonyu-115, your suggested "3rdparty/Automodel-workspace/Automodel/tools/offline_hf_consolidation.py" works for me. Thanks for the help!
vikalluru commentedon Sep 4, 2026
@sharonyu-115 - can you close the issue if it works for you?