Repository navigation
refactor(workers)!: unify worker class selection through config - #4176
Conversation
ff7adc1 to
fe6d468
Compare
|
Rebased onto main ( The focused CPU selection passes 84 tests, including the FP32 LM-head cases. Changed-file formatting, lint, TOML, and recipe checks pass. Targeted Pyrefly reports zero errors under the repository configuration. The full-repository Pyrefly hook could not start because the local Automodel submodule is not populated; GPU/distributed validation still requires the full environment and maintainer-authorized CI. |
fe6d468 to
ea794c2
Compare
|
Rebased onto main ( The focused CPU selection passes 88 tests (39 deselected), including the FP32 LM-head cases. Changed-file formatting, lint, TOML, and recipe checks pass; targeted Pyrefly reports zero shown errors under the repository configuration. Full-repository Pyrefly remains blocked locally by the unpopulated Automodel submodule. GPU/distributed validation was not run and still requires maintainer-authorized CI for this SHA. The PR description now contains the current results and reproduction command. |
ea794c2 to
82b433e
Compare
82b433e to
a297e5d
Compare
|
@yuki-97 Rebased onto main at The focused CPU selections pass 79 + 21 tests; changed-file lint/format and targeted type checks also pass. GPU/distributed validation has not run. Could you review the worker-selection path for #4032 and help authorize CI for this SHA? |
a297e5d to
24c2760
Compare
|
@yuki-97 Rebased on main and fixed the conflicts. The template and worker tests now use the Automodel names. All 144 focused CPU tests pass; GPU tests still need CI. Could you review the worker-selection change and authorize CI for |
Resolve ModelOpt requirements through worker_extension_cls_fqn, deprecate the Policy constructor override, and migrate the template and teacher configuration. BREAKING CHANGE: custom quantized worker subclasses passed through the Policy constructor must now match the backend ModelOpt worker, as required for config overrides. Signed-off-by: Yuchen Wang <[email protected]>
24c2760 to
8ee8c68
Compare
There was a problem hiding this comment.
hi @yuchenwang3 , sorry for late reply. thanks for helping refactor this, much more clean than before!
@RayenTian could you help review it?
|
/ok to test c9aec4e |
…-config Signed-off-by: Yuki Huang <[email protected]>
yuki-97
left a comment
There was a problem hiding this comment.
Merge blockers — please rebase on main; the PR is 11 commits behind and the "Check if PR branch is up to date" job allows at most 10.
Thanks for making worker_extension_cls_fqn the single place that picks the policy and vLLM worker class, with quant_cfg now a check on that field, as #4032 proposed.
Thanks also for the nine-comment self-review and for fixing all nine before this pass.
Scope: the worker-selection change, its docs, the research template and tests, checked against the proposal in #4032, at c9aec4e
Checked:
- Every item of #4032 is implemented as proposed: an unset field is filled with a warning, the matching ModelOpt worker is accepted, anything else raises with the expected FQN (
config.py:50-66). - The deprecated constructor argument is copied into the config before the one resolver, so both channels get the same quant check and registration check (
lm_policy.py:133-140). - All 14 shipped configs that resolve to a non-null
quant_cfgselect the same worker classes as on main. - The resolved class, not a key read back from the config, is checked for registration before any worker or placement group is created (
lm_policy.py:343-344,vllm_generation.py:381-389).
Remaining comments are on:
- SFTv2 with
quant_cfgset. - The research extension-points reference, which still describes the old mechanism.
nit
- The quantization guide lists Automodel among the backends with a ModelOpt worker.
- Assertions in the policy tests that cannot fail.
- The
.getfallback in the two worker resolvers.
nemo-rl-review: kind=expert harness=claude-code/2.1.332 model=claude-fable-5-2 effort=medium review-pr-team=v3 reviewed=c9aec4e
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test b000aa5 |
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test 98c4eff |
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test 0a7188f |
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test d9cf2a3 |
yuki-97
left a comment
There was a problem hiding this comment.
Self-review via /review-pr-team of merge commit d9cf2a3, which brings #3945 (real-quant vLLM rollout) from main into this PR's worker selection: 6 agents (RL expert, test, bug-finder, design, comment-reviewer, comment-editor) + devil's-advocate pass.
Verdict — no findings above the confidence bar. LGTM, no action needed.
Verified clean
real_quantas a second trigger —resolve_generation_worker_clsnow also picks the ModelOpt vLLM worker whenpolicy.generation.real_quantis set; a real-quant run needs this because it must leavepolicy.generation.quant_cfgnull,vllm/utils.py:1369,modelopt/utils.py:43-48- Rejection added on
main— everyworker_extension_cls_fqn+quant_cfg/real_quantcase thatmainrejected inVllmGeneration.__init__still raises before placement groups are created, except the exact ModelOpt worker, which this PR accepts,vllm_generation.py:387,utils/config.py:60-64 - Docs and config comments — the "Worker Class Selection" paragraph, the
grpo_math_1B.yamlgeneration comment and theVllmConfig.worker_extension_cls_fqncomment match the code for both keys,quantization-aware-rl.md:18-22 - Earlier fixes — every fix from the resolved threads is still in place after the merge, including the indexed
GENERATION_WORKER_OVERRIDES[default_cls]wheremainhad a.getfallback,vllm/utils.py:1368
nemo-rl-review: kind=expert harness=claude-code/2.1.334 model=claude-fable-5-2 effort=medium review-pr-team=v3 reviewed=d9cf2a3
What and why
On main, a config-provided
worker_extension_cls_fqnis rejected wheneverquant_cfgis set, even if it names the correct quantized worker, while thePolicy(worker_extension_cls_fqn=...)constructor argument can replace that worker without the same check. This PR makesworker_extension_cls_fqnthe common selection path for policy and vLLM workers.The shared resolver (
resolve_worker_clsinnemo_rl/utils/config.py, called byresolve_policy_worker_clsandresolve_generation_worker_cls) fills an omitted FQN with the backend's quantized worker and warns, accepts an exact match, and rejects a mismatch with the expected FQN before allocating workers. Existing quant-only recipes keep automatic worker selection.PolicyandVllmGenerationthen check that the resolved worker is registered inACTOR_ENVIRONMENT_REGISTRY, also before allocating workers.The
Policyconstructor argument now emits a deprecation warning and feeds the config path. The two in-repo callers set the config field instead: the research template selects its extension in YAML, andsetup_sft_v2()setspolicy.worker_extension_cls_fqntonemo_rl.data.energon.sft_worker.SFTMegatronPolicyWorkerbefore buildingTQPolicyand rejects a different configured value. Frozen teachers clear the copied student extension alongside quantization settings.Typing the resolvers'
configasPolicyConfig/VllmConfigfixes three Pyrefly errors, so their entries are removed frompyrefly-baseline.json.Usage and compatibility
Leave
worker_extension_cls_fqnunset to keep automatic selection, or set it to the FQN printed by the warning. An explicit quant worker must match the policy backend or vLLM sync/async mode. The Automodel backend usesautomodel_cfg.Compatibility change: custom subclasses passed through
Policy(worker_extension_cls_fqn=...)withquant_cfgare now rejected, just like config-provided mismatches. Non-quantized custom extensions remain supported. The deprecated argument still works when it satisfies the config validation rules; conflicting constructor/config values remain errors.Issues
Closes #4032.
Convergence / perf / functionality proof
N/A for convergence and perf: only setup-time worker selection and validation change; recipes that use the default workers, or quantized recipes that omit the field, get the same worker classes as before.
Functionality: CPU unit tests run locally at
ac546241, which includes main atda067f1331683b136022ab39172673fc05702dfe.tests/unit/utils/test_config.pytests/unit/utils/test_outdated_config_checks.pytests/unit/distributed/test_actor_environments.pytests/unit/models/policy/test_policy_validation.pytests/unit/models/policy/test_teacher_worker_group.pytests/unit/models/generation/test_vllm_generation.pytests/unit/algorithms/test_sft_v2.pytests/unit/telemetry/test_sft_v2.pytests/unit/data/test_energon_sft_v2.pymegatron.energon(mcoreextra)No GPU was available, so no GPU test ran. The 15 failures and 2 errors in
test_vllm_generation.pyare GPU tests that could not get GPU placement groups or found no NVIDIA driver. The 21 errors intest_policy_validation.pyhappen in a fixture that loads the gatedmeta-llama/Llama-3.2-1Bconfig, which this machine cannot download. The skips need a CUDA device or three GPUs, or are skipped in the test itself. The same tests fail or skip in the same way at the previous head, 32cabe1, on this machine.tests/unit/utils/test_config.py, with the other tests fornemo_rl/utils/config.py. The vLLM selection cases are intests/unit/models/generation/test_vllm_generation.py, next to the existing worker-extension tests. Earlier revisions of this PR had them intests/unit/models/test_worker_config.pyandtests/unit/models/generation/test_vllm_worker_selection.py; both files are removed.Reproduce the focused selection in a configured test environment:
Pre-checks
Needs upstream changes
None.
PR commands and CI
CI:Lfast: the default for most PRs. Runs a fast test subset.CI:L1: dependency or container changes (pyproject.toml,uv.lock,Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.CI:docs: docs-only changes. Runs doc tests only./ok to test <full-commit-sha>: start CI for that commit. Post again after each push./review: automated review comments. Addmode=strictfor a stricter review,reset=truefor a fresh full review./resolve-conflict: Autobot mergesmaininto this PR and resolves the conflicts. PRs from forks must allow edits by maintainers./review-pr-team <pr-number>for a team review before you ask for human review.Assisted-by: OpenAI Codex
Assisted-by: Claude Code