test: add FSDP2 distributed coverage for AsyncGRPOTrainer#6144
Open
behroozazarkhalili wants to merge 3 commits into
Open
test: add FSDP2 distributed coverage for AsyncGRPOTrainer#6144behroozazarkhalili wants to merge 3 commits into
behroozazarkhalili wants to merge 3 commits into
Conversation
Adds a 2-process FSDP2 functional test for the experimental AsyncGRPOTrainer, which previously had no distributed-test coverage. test_train_fsdp2 launches a companion worker via accelerate launch under a 2-process FSDP2 config and asserts the trainer trains end-to-end on FSDP2-sharded parameters (steps run, loss finite, params update). It uses an in-process stub rollout worker (no vLLM server / NCCL weight transfer), so the only distributed surface exercised is the FSDP2 parameter lifecycle. Guarded by require_torch_multi_accelerator so it skips when fewer than 2 accelerators are available.
…-coverage # Conflicts: # tests/experimental/test_async_grpo_trainer.py
|
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. |
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.
What
Adds a 2-process FSDP2 functional test for the experimental
AsyncGRPOTrainer, which previously had no distributed-test coverage (tests/experimental/test_async_grpo_trainer.pyonly ran single-process).test_train_fsdp2launches a companion worker viaaccelerate launchunder a 2-process FSDP2 config and asserts the trainer trains end-to-end on FSDP2-sharded parameters: training steps run, the loss is finite, and parameters update. It uses an in-process stub rollout worker (no vLLM server / NCCL weight transfer), so the only distributed surface exercised is the FSDP2 parameter lifecycle. The test is guarded by@require_torch_multi_accelerator, so it skips automatically when fewer than 2 accelerators are available.Why
AsyncGRPOTrainerruns under FSDP2 in practice but had no test confirming it trains under a real 2-process FSDP2 group. This closes that gap with a lightweight functional smoke that mirrors the existing_openreward_echo_env.pycompanion-script pattern.Test plan
Verified on 2x H100:
Skips cleanly on single-GPU / CPU.
ruff checkandruff formatpass.Note
Low Risk
Test-only changes with no production trainer or runtime behavior modifications.
Overview
Adds 2-process FSDP2 functional coverage for experimental
AsyncGRPOTrainer, which previously only had single-process training tests.A new
test_train_fsdp2(guarded by@require_torch_multi_accelerator) spawns_async_grpo_fsdp2_worker.pyviaaccelerate launchand a dedicatedfsdp2_reshard.yaml(FSDP v2,fsdp_reshard_after_forward: true). The worker runs a shortAsyncGRPOTrainerjob with an in-process stub rollout (no vLLM / NCCL weight sync), then emits a singleASYNC_GRPO_FSDP2_RESULTJSON line; pytest asserts steps ran, finite train loss, and parameters changed after materializing FSDP2DTensors for comparison.PYTHONPATHis pinned to the repo root so the subprocess exercises the working tree, not an installedtrlpackage.Reviewed by Cursor Bugbot for commit d6d198d. Bugbot is set up for automated code reviews on this repo. Configure here.