Add several fixes to distributed training#1835
Open
QuantuMope wants to merge 2 commits into
Open
Conversation
le-horizon
reviewed
May 29, 2026
le-horizon
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the fixes, Andrew.
A couple points from codex if they make sense:
- alf/algorithms/distributed_off_policy_algorithm.py:155
DistributedOffPolicyAlgorithm.state_dict() now returns only self._core_alg.state_dict(). The trainer replay buffer lives on the distributed wrapper, not the core alg, so distributed checkpoints saved after this change will not include _replay_buffer.* keys. That makes the new checkpoint-loading setup at lines 519-569 ineffective for replay data: resume creates an empty multiprocessing replay buffer, then loads only core model/optimizer state. It also cannot load older distributed checkpoints that do contain wrapper _replay_buffer.* keys because load_state_dict() delegates straight to the core alg.
Need to throw error when resuming a ckpt encounters an empty replay buffer.
Need to add unittest coverage for the correct ckpt and reload.
- alf/algorithms/distributed_off_policy_algorithm.py:211
summarize_metrics() now only calls self._core_alg.summarize_metrics(). The wrapper owns the env metrics created by RLAlgorithm.init, and unroller rollout updates those wrapper metrics via inherited observe_for_metrics(). This drops normal unroller env metric summaries such as episode count, env steps, return, and episode length. This should likely call super().summarize_metrics() as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds several fixes for distributed training. The first 5 are in the first commit d281324 while the last one is in the second commit 4688708.
summarize_metrics(self)call so that summaries from the algorithm are recorded.weights_only=Falsetotorch.loadfortorch.__version__ >= 2.6.DistributedUnrollertriggered byi % 0.DistributedTrainer.