Skip to content

🌊 Add error for iterable datasets in GRPOTrainer #3216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2025
Merged
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
13 changes: 13 additions & 0 deletions trl/trainer/grpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,19 @@ def data_collator(features): # No data collation is needed in GRPO
self.use_vllm = args.use_vllm
self.use_liger_loss = args.use_liger_loss

# Datasets
if (
isinstance(train_dataset, IterableDataset)
or isinstance(eval_dataset, IterableDataset)
or (
isinstance(eval_dataset, dict) and any(isinstance(ds, IterableDataset) for ds in eval_dataset.values())
)
):
# See https://github.com/huggingface/trl/issues/3213
raise NotImplementedError(
"Iterable datasets are not yet supported in GRPOTrainer. Please use a standard dataset instead."
)

# Multi-step
self.num_iterations = args.num_iterations # = 𝜇 in the GRPO paper
self.epsilon_low = args.epsilon
Expand Down
Loading