fix: set per_device_train_batch_size to match dataset size#240
Merged
Conversation
TRL's default per_device_train_batch_size=8, but with 1-3 tasks the dataset is too small to form a single batch. TRL computes 0 steps and exits with "There seems not to be a single sample in your epoch_iterator". Fix: set batch_size=n_tasks when building default GRPOConfig. When the user provides their own trl_config, warn if batch_size > dataset size. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
batch_size=n_tasks could OOM on GPU with many tasks. batch_size=1 is safer and matches the standalone trainer behavior (one task per step, rotating through tasks via epochs). Each step still does num_generations rollouts, so learning signal is preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
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.
Summary
TRL's default
per_device_train_batch_size=8, but with 1-3 tasks the dataset is too small to form a single batch. TRL computes 0 steps and exits with "There seems not to be a single sample in your epoch_iterator".Fix: set
batch_size=n_taskswhen building default GRPOConfig. When user provides their owntrl_config, warn ifbatch_size > dataset_size.Test plan
🤖 Generated with Claude Code