Skip to content

refactor(grpo): migrate TypedDict configs to pydantic BaseModel - #2518

Merged
yuki-97 merged 26 commits into
mainfrom
nliang/typeddict-to-basemodel-grpo
Aug 4, 2026
Merged

yuki-97 merged 26 commits into
mainfrom
nliang/typeddict-to-basemodel-grpo

Conversation

@NolenLiang

@NolenLiang NolenLiang commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Results before / after the changes

image image image

@NolenLiang
NolenLiang requested review from a team as code owners May 18, 2026 07:34
@copy-pr-bot

copy-pr-bot Bot commented May 18, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@NolenLiang NolenLiang added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label May 18, 2026
@NolenLiang NolenLiang changed the title Nliang/typeddict to basemodel grpo refactor(grpo): migrate TypedDict configs to pydantic BaseModel May 18, 2026
@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test b37bbb9

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 77aec62768f3f5e17bba09dfea25e8b58b4df7b1

@copy-pr-bot

copy-pr-bot Bot commented May 18, 2026

Copy link
Copy Markdown

/ok to test 77aec62768f3f5e17bba09dfea25e8b58b4df7b1

@NolenLiang, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 77aec62

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 77aec62

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 36dc855

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 85be127

NolenLiang and others added 18 commits August 3, 2026 01:02
run_grpo.py, run_grpo_nemo_gym.py, run_grpo_sliding_puzzle.py still
used config.grpo["key"] and "async_grpo" in config.grpo patterns.
The "in" check on a BaseModel doesn't work like dict membership,
causing async routing to fall through to sync grpo_train.

Signed-off-by: nliang <[email protected]>
checkpointer.load_training_info() returns a plain dict from JSON
deserialization. With GRPOSaveState as BaseModel, cast() alone
doesn't convert it. Add isinstance check to construct BaseModel
from dict on checkpoint resume.

Signed-off-by: nliang <[email protected]>
All fields in GRPOConfig, RewardScalingConfig, AsyncGRPOConfig,
AdvEstimatorConfig, and RewardShapingConfig now have default values
matching the reference config (grpo_math_1B.yaml). This allows
constructing configs with just the overrides needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: nliang <[email protected]>
@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 775ad1c

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test e26f778

@yuki-97

yuki-97 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

/ok to test 12655cd

@yuki-97

yuki-97 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

/ok to test 2985348

@yuki-97

yuki-97 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

CI:L1 passed in https://github.com/NVIDIA-NeMo/RL/actions/runs/30827595312/job/91859466286 w/ temporarily skipped test_refit_finalization_falls_back_for_older_trtllm in 2985348 which was failed on main, changed to CI:Docs and removed the temporarily skip code to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:docs Run doctest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants