Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tunix/rl/grpo/grpo_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ def _generate_and_compute_advantage(
pad_value = self.rl_cluster.rollout.pad_id()
eos_value = self.rl_cluster.rollout.eos_id()

# === GRPO FIX: validate grouping ===
if self._rollout_micro_batch_size < self.algo_config.num_generations:
raise ValueError(
f"GRPO requires rollout_micro_batch_size >= num_generations. "
f"Got rollout_micro_batch_size={self._rollout_micro_batch_size}, "
f"num_generations={self.algo_config.num_generations}. "
f"Increase train_micro_batch_size or reduce num_generations."
)

if self._compute_logps_micro_batch_size < self.algo_config.num_generations:
raise ValueError(
f"GRPO requires compute_logps_micro_batch_size >= num_generations. "
f"Got compute_logps_micro_batch_size={self._compute_logps_micro_batch_size}, "
f"num_generations={self.algo_config.num_generations}. "
f"Increase compute_logps_micro_batch_size or reduce num_generations."
)
# ==================================
# TODO (noghabi): Add mini batch and micro batch tags
perf_tags = {
perf_constants.STEP: self.rl_cluster.global_steps,
Expand Down