Repository navigation
Conversation
This branch has not been deployed
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.
When the rollout size is not divisible by
num_mini_batches, the feedforward generator shuffles onlynum_mini_batches * (batch_size // num_mini_batches)transitions. The recurrent generator similarly slices onlynum_mini_batches * (num_envs // num_mini_batches)environments. This permanently excludes the tail from every training epoch. For five environments, three rollout steps and two mini-batches, the feedforward path drops one transition and the recurrent path drops all three transitions from the final environment.Partition the complete rollout/environment range using integer boundaries
i * size // num_mini_batches. All samples are included exactly once per epoch, the number of optimizer updates stays the same, and batch sizes differ by at most one. Recurrent observations, masks and initial GRU/LSTM states continue to use the matching trajectory boundaries. Feedforward shuffling still happens once per generator, preserving the existing order across epochs. Invalid counts outside1..sizenow raise a clearValueErrorinstead of producing empty batches or dividing by zero.The regression tests check complete per-epoch coverage, alignment of every batch field, recurrent episode-start states, real GRU/LSTM backward passes and a real PPO update whose only learnable cue occurs in the discarded tail. Divisible partitions retain their previous batch contents, order and Torch RNG state exactly in 24 additional profiles (1,144 recorded arrays).
Validation with Python 3.12.14, Torch 2.7.1+cpu, TensorDict 0.7.2 and NumPy 2.3.5:
pytest -q tests -k 'not TestDistributedAlgorithms': 216 passed, four deselected. The same selected scope on the unchanged base gives 25 failed and 191 passed, with those same four profiles deselected.pre-commit run --all-files: all configured checks passed.The four actual Gloo multiprocess tests were not run in this local environment; the complete upstream distributed matrix remains necessary. GPU/simulator training, long-run convergence and other Python-version matrices were not tested. This draft makes no training-performance claim.