Skip to content

Fix AsyncGRPOTrainer crashing on environment-owned datasets - #6824

Merged
albertvillanova merged 1 commit into
mainfrom
fix-async-grpo-args-before-init
Aug 20, 2026
Merged

albertvillanova merged 1 commit into
mainfrom
fix-async-grpo-args-before-init

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

This PR fixes AsyncGRPOTrainer raising AttributeError: 'AsyncGRPOTrainer' object has no attribute 'args' when it is built without a train_dataset.

FAILED tests/experimental/test_async_grpo_trainer.py::TestAsyncGRPOTrainer::test_environment_owned_data_requires_max_steps - AttributeError: 'AsyncGRPOTrainer' object has no attribute 'args'

Bug introduced by PR:

The feature #6349 added has never worked.

Motivation

AsyncGRPOTrainer.__init__ reads self.args while building the placeholder dataset, but self.args is only set by Trainer.__init__, which runs a few lines later. Every environment-owned run, meaning train_dataset=None together with an environment_factory, fails there before it can reach either the intended max_steps ValueError or the placeholder dataset construction.

The existing regression test, TestAsyncGRPOTrainer::test_environment_owned_data_requires_max_steps, does cover this, but it never ran: tests/experimental is excluded from the regular suite through norecursedirs, and in tests-experimental.yml the whole class is gated behind is_ampere_or_newer(), which was false on the T4 runner. Moving that job to an L40S in #6741 makes the test execute for the first time and surfaces the failure.

Solution

Use the local args instead of self.args in the pre-super().__init__() region, consistent with every other config read in that block. AsyncDistillationTrainer is unaffected: it assigns self.args = args before its own super().__init__().

Changes

  • Read max_steps, per_device_train_batch_size and gradient_accumulation_steps from the local args when building the placeholder dataset in AsyncGRPOTrainer.__init__

Note

Cursor Bugbot is generating a summary for commit cfa4913. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@albertvillanova

Copy link
Copy Markdown
Member Author

I am merging this as a hotfix.

@albertvillanova
albertvillanova merged commit ce01ad4 into main Aug 20, 2026
6 checks passed
@albertvillanova
albertvillanova deleted the fix-async-grpo-args-before-init branch August 20, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant