Skip to content

test(automodel): rename the dtensor-named tests and merge the two worker files - #4703

Merged
terrykong merged 8 commits into
r0.8.0from
yukih/rename-dtensor-tests-to-automodel
Oct 15, 2026
Merged

terrykong merged 8 commits into
r0.8.0from
yukih/rename-dtensor-tests-to-automodel

Conversation

@yuki-97

@yuki-97 yuki-97 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Part of the DTensor v1 removal series -- overall status is tracked in the description of #4198.
The rename is split in three:

  1. test(suites): rename the backend token in recipe filenames to automodel #4701 — recipe filenames: dtensor, fsdp2*, fsdp4ep4 / fsdp8ep8 → automodel*
  2. test(automodel): rename the dtensor-named tests and merge the two worker files #4703 (this PR) — unit and functional tests: test names, shard labels, and the merge of test_dtensor_worker.py into test_automodel_worker.py
  3. docs(automodel): rename the DTensor backend to Automodel #4277 — docs, example and reference configs, and the comments and messages under nemo_rl/; merges last as the final sweep

Covers Part A of #4535.

Scoped to r0.8.0. Leftovers that exist only on main are not swept here, and the cherry-picks
will not sweep them either -- once all three have landed on main, a follow-up PR against main
cleans up everything that remains.

What does this PR do ?

Renames the backend to Automodel across the unit and functional tests, and merges the two
policy-worker test files into one.
Tests only, except three production error messages the tests
assert on -- and one real bug, below.

What changed

1. Merge test_dtensor_worker.py into test_automodel_worker.py. 25 + 10 tests, all 35 present
afterwards. The two files each had a create_test_config; the merged one is their union --
precision and sequence_packing_enabled already defaulted to what the other hardcoded, and
single_rank_consolidation / consolidation_timeout_minutes are required keys the dtensor copy was
missing. excluded_unit_tests.sh had --ignore'd the whole automodel file while keeping three
correctness checks from the dtensor one; keeping --ignore would have dropped those three from
Lfast, so it is now 32 explicit --deselects plus the 6 llama logprob variants, each verified to
resolve against a real test.

2. The LoRA worker tests never enabled LoRA. They wrote automodel_cfg["lora"], but the schema,
every shipped YAML and all three readers use lora_cfg; nothing reads lora, and there is no
compat shim. enabled: True landed on a dead key, so test_worker_training_with_lora and
test_worker_logprob_with_lora have been exercising the plain path and passing. Both now point at
lora_cfg. This is the one change that can newly fail -- it needs L0/L1, since Lfast deselects
both.

3. Renames. 37 test functions (dropping dtensor_v2, and the automodel tag where the file or
directory already says it -- test_megatron_value_worker.py and test_automodel_value_worker.py
already share identical test names); tests/unit/models/dtensor/test_lora.py ->
models/automodel/ (pure move: conftest.py filters on the marker, never on path, and that file
carries none); grpo_trtllm_fsdp2_colocated.sh -> grpo_trtllm_automodel_colocated.sh; the labels
inside sft_resume_diamond.sh; 11 shard-script comments, two of which named shards that no longer
exist.

4. Three production error messages. grpo.py, ppo.py and policy/utils.py said "DTensor
backend"/"DTensor has no matching" in asserts guarded by automodel_cfg.enabled. Changed with the
match= strings that assert on them -- they cannot move separately.

Also fixed: test_converter_roundtrip.py printed that "Dtensor V1 and Dtensor V2 DCP and
Megatron roundtrip checkpoints are identical", but the test builds one DCP checkpoint (STEP 2) and
converts it once (STEP 4). There is no second DCP path.

Deliberately not changed

  1. convert.py's "DTensor v1 layout" and its match="DTensor v1". That layout really was DTensor
    v1 (v0.7 and older); Automodel would be the wrong name for it.
  2. dtensor_cfg wherever it names the legacy config key -- that is the migration check itself.
  3. FSDP2Config, use_torch_fsdp2, DTensor.redistribute, get_dst_dtensor, MockFSDPWorker:
    mechanism names, still what the code operates on.
  4. tests/unit/reference_configs/*.yaml (5 comment lines). They are byte-mirrors of
    examples/configs/*.yaml, which tests/unit/test_config_v2.py diffs against, so they have to
    move with the originals -- and the originals are the third PR's. Same for
    test_config_validation.py:311-312, whose docstring quotes the same prose and links
    dtensor-tp-accuracy.html, a doc that PR renames.
  5. The remaining DTensor v2 prose in nemo_rl/, examples/ and docs/ -- that is the third PR
    in this split.

Reading the diff: git pairs the deleted test_dtensor_worker.py with the grown
test_automodel_worker.py as a 57%-similar rename, so commit fb7b3bc93 renders as if the
automodel file were replaced. git show --no-renames shows the real shape.

🤖 Generated with Claude Code

@yuki-97 yuki-97 added cherry-pick-to-main Opt in: cherry-pick this PR's commit from the release branch back into main CI:L1 Run doctests, unit tests, and functional tests labels Oct 13, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 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.

@yuki-97

yuki-97 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 45605a1

@yuki-97 yuki-97 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review via /review-pr-team: 3 agents (rl-expert, bug-finder, test-agent) + devil's-advocate pass.

Verdict — 1 inline comment: the docstring edit at test_config_validation.py:311 contradicts the PR body and conflicts with #4277; not blocking.

Verified clean

  • The merged test_automodel_worker.py has 35 tests = 10 + 25 from the two base files: none missing, none added, no marker changed, no duplicate names, and each test keeps the same Lfast / L0 tier set.
  • lora_cfg is the real schema key (nemo_rl/models/policy/__init__.py:215) read by all three consumers; base wrote the dead "lora" key, and the tests now supply every required LoRAConfig field.
  • No reference to test_dtensor_worker, models/dtensor, the old test names or grpo_trtllm_fsdp2_colocated remains anywhere (incl. .github/, docs, pyrefly.toml).
  • Shard-script edits are comment-only, so no pytest argument or path changed.

Lower-priority notes that are not inline

  • The LoRA fixtures skip rather than fail when Policy(...) construction raises (_base_setup_impl, pre-existing except Exception: pytest.skip), so a green L0/L1 does not prove LoRA constructed; the skip count for the 8 LoRA cases is worth reading.
  • test_lm_policy_init[enable_loras=True] is a third path that now exercises real LoRA. It builds Policy without the skip wrapper, so a failure there is a hard failure; the body names only the two worker tests.
  • excluded_unit_tests.sh:89,129 deselect two ids that do not exist (identical at base).
  • The "Deliberately not changed" list skips item 5.

Generated by Claude Code

Comment thread tests/unit/test_config_validation.py Resolved
@yuki-97
yuki-97 force-pushed the yukih/rename-dtensor-tests-to-automodel branch 2 times, most recently from 1c4389e to 6c2e476 Compare October 13, 2026 15:24
@yuki-97
yuki-97 marked this pull request as ready for review October 13, 2026 16:23
@yuki-97
yuki-97 requested a review from terrykong October 13, 2026 16:23

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this rename and merge. Overall it is in good shape, with one blocker.

Blocker: the merge breaks the L0 Automodel policy shards, and this PR's own CI shows it. The module-scoped cluster now holds both GPUs until the merged file ends, so the class-scoped clusters later in the file time out after 180 s. In Automodel_Policy_1 that shows up as a green job with 21 skips; _2 and _3 fail. Fix: make the fixture function-scoped. The PR body says the lora_cfg fix "is the one change that can newly fail"; the merge newly fails too.

After that fix, please check the skip count in Automodel_Policy_1-3. Main skips 2 per shard. That is how you will know the LoRA tests really ran.

Unrelated to this PR: L0_Unit_Tests_Other failed test_nightly_compute_stays_below_4769_hours (4773 h). That comes from the base branch; fa1ae62 (#4704) on r0.8.0 raised the cap to 4790, so a rebase clears it.

What is good here:

  • Catching the dead lora key and switching to lora_cfg is a real bug fix.
  • The merged create_test_config keeps every default the old dtensor tests used.
  • The comment explaining why the file is listed test by test instead of --ignored is the right one to leave.
  • Your self-review note about _base_setup_impl turning setup errors into skips was right. The comment on L1066 is that note plus a fix.

Checked and clean: the error messages and their match= strings; no old names left anywhere; all 38 deselects resolve, and Lfast keeps the same 12 test ids; the sft_resume_diamond labels; the converter print.

Generated by Claude Code

Comment thread tests/unit/L0_Unit_Tests_Models_1.sh Resolved
Comment thread tests/unit/L0_Unit_Tests_Models_1.sh Resolved
Comment thread tests/unit/excluded_unit_tests.sh Resolved
@yuki-97
yuki-97 force-pushed the yukih/rename-dtensor-tests-to-automodel branch from 6c2e476 to 6d07068 Compare October 14, 2026 14:54
…run test_lora.py in the automodel lane, assert LoRA is applied

Signed-off-by: Yuki Huang <[email protected]>
…uding the sub-second tests from Lfast

Signed-off-by: Yuki Huang <[email protected]>
@yuki-97

yuki-97 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5bbd18b

@terrykong
terrykong enabled auto-merge (squash) October 14, 2026 17:54
@terrykong
terrykong merged commit a3ba27a into r0.8.0 Oct 15, 2026
261 of 265 checks passed
@terrykong
terrykong deleted the yukih/rename-dtensor-tests-to-automodel branch October 15, 2026 00:23
terrykong pushed a commit that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-to-main Opt in: cherry-pick this PR's commit from the release branch back into main CI:L1 Run doctests, unit tests, and functional tests Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants