feat(grpo): support async multiple dataloaders#2454
Open
taivu1998 wants to merge 1 commit into
Open
Conversation
Signed-off-by: taivu1998 <46636857+taivu1998@users.noreply.github.com>
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.
Summary
Fixes #2006.
This PR enables standard async GRPO to run with
data.use_multiple_dataloader=truewhile keeping async NeMo-Gym GRPO explicitly unsupported for that path.Root Cause
The standard async entrypoint blocked multiple dataloaders outright, and the async collector consumed the next prompt batch before reserving the target weight version. That ordering prevented custom multiple-dataloader functions from seeing the async generation target they were sampling for. The wrapper also eagerly held live iterators and Hydra-loaded callables, which made it a poor object to ship into a Ray actor or checkpoint from async collection.
Changes
MultipleDataloaderWrapperlazy, picklable, and checkpointable with per-task dataloader state.train_dataloader_<task>.pt, matching synchronous GRPO resume behavior.examples/run_grpo.py.Validation
uvx --python /Users/vuductai/.local/share/uv/python/cpython-3.12-macos-aarch64-none/bin/python3.12 ruff check nemo_rl/data/dataloader.py nemo_rl/algorithms/async_utils.py nemo_rl/algorithms/grpo.py examples/run_grpo.py examples/nemo_gym/run_grpo_nemo_gym.py examples/custom_dataloader/custom_dataloader.py tests/unit/data/test_multiple_dataloader.py/Users/vuductai/.local/share/uv/python/cpython-3.12-macos-aarch64-none/bin/python3.12 -m py_compile nemo_rl/data/dataloader.py nemo_rl/algorithms/async_utils.py nemo_rl/algorithms/grpo.py examples/run_grpo.py examples/nemo_gym/run_grpo_nemo_gym.py examples/custom_dataloader/custom_dataloader.py tests/unit/data/test_multiple_dataloader.py tests/unit/algorithms/test_async_utils.pygit diff --checkuv run pytest tests/unit/data/test_multiple_dataloader.py tests/unit/algorithms/test_async_utils.pyis currently blocked on this macOS host before test collection because/usr/local/bin/python3.13is broken:platform.mac_ver()returns an empty value. The repository requires Python>=3.13.13, anduv python install 3.13.13reports no matching macOS aarch64 download.