Skip to content

Commit

Permalink
📄 Add GRPO batch size note in docs (#2672)
Browse files Browse the repository at this point in the history
* add note for OOM error

* update note

* Apply suggestions from code review

---------

Co-authored-by: Quentin Gallouédec <[email protected]>
  • Loading branch information
sdpkjc and qgallouedec authored Jan 30, 2025
1 parent 094d51b commit 9ac8d97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/grpo_trainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ This example demonstrates how to train a model using the GRPO method. We train a
></iframe>
Below is the script to train the model.
Note that the input tensor for the forward pass has a size of `num_generations * per_device_train_batch_size` because GRPO generates `num_generations` completions for each prompt in the batch. Adjusting these values appropriately can help prevent OOM errors.
Consequently, the effective train batch size is `num_generations * per_device_train_batch_size * gradient_accumulation_steps`.

```python
# train_grpo.py
Expand Down

0 comments on commit 9ac8d97

Please sign in to comment.