Skip to content

Rename the remaining DTensor-named tests and wording to Automodel #4535

Closed

Description

@yuki-97

#4282 renamed the workers themselves (DTensorPolicyWorkerV2 -> AutomodelPolicyWorker,
dtensor_policy_worker_v2.py -> automodel_policy_worker.py, the rl.backend tracing tag,
the Timer label). It deliberately left the items below, which are wording-only or file moves
and touch files the config-rename PR (#4283) also edits.

Split across two PRs so the file moves do not sit in the same diff as the prose:

Keeping them out of #4282 and #4283 avoids conflicts in examples/configs/*.yaml and
nemo_rl/models/policy/__init__.py.

Paths and line numbers are as of #4282, i.e. after its rename lands on main.


Part A — new PR: test renames and file moves

1. Test function names (11)

tests/unit/models/policy/test_automodel_worker.py — 10 functions still named
test_dtensor_v2_*: L64, L88, L126, L138, L287, L382, L876, L892, L920, L935.

tests/unit/models/policy/test_lm_policy_collective.py:156 —
test_policy_forwards_final_checkpoint_marker_to_dtensor_v2.

Safe to rename: tests/unit/excluded_unit_tests.sh excludes the worker file with --ignore=
on the whole file, not with per-test --deselect, so no exclusion silently stops matching.

2. Shard header comments (3)

tests/unit/L0_Unit_Tests_Automodel_Policy_{1,2,3}.sh:16 all read
(test_dtensor_worker*.py, test_automodel_types.py). That glob no longer covers the renamed
test_automodel_worker.py.

3. Move the last file out of tests/unit/models/dtensor/

tests/unit/models/dtensor/test_lora.py is the only file in that directory (there is no
__init__.py), and nemo_rl/models/dtensor/ was deleted in #4198, so the directory name points
at source that no longer exists. The test itself exercises
nemo_automodel.components._peft.lora.

Move it to tests/unit/models/automodel/test_lora.py and drop models/dtensor/ from the four
tests/unit/L0_Unit_Tests_Models_{1,2,3,4}.sh:17 comments.

This is a pure rename, not a change of which shard runs it: tests/unit/conftest.py
pytest_collection_modifyitems filters on the automodel marker only, never on path, and
test_lora.py carries no marker (it uses a module-level pytest.skip on ImportError
instead). tests/unit/models/automodel/ already holds two unmarked files
(test_automodel_convert.py, test_logprob_memory.py), so an unmarked file there keeps being
collected by the base Models_* shards and keeps being excluded from --automodel-only.

While editing those four files, line 18 says models/automodel/ (all automodel) are excluded by conftest.py filtering, which is already inaccurate for the reason above. Worth correcting in
the same pass.

Nothing pins the current path: no shard script or excluded_unit_tests.sh entry references it,
and git grep models/dtensor across the repo matches only those four comment lines.

4. Merge the two worker test files

Merge tests/unit/models/policy/test_dtensor_worker.py into
tests/unit/models/policy/test_automodel_worker.py. The v1 worker is gone (#4198), so the
two files no longer describe two backends. tests/unit/excluded_unit_tests.sh has 15 lines
referencing test_dtensor_worker.py that have to move with it.


Part B — #4277: "DTensor v2" wording (31)

File Lines
nemo_rl/models/automodel/checkpoint.py 14, 72, 103
nemo_rl/models/policy/__init__.py 42, 188
nemo_rl/models/value/lm_value.py 106, 432
nemo_rl/algorithms/single_controller_utils/config.py 1193
nemo_rl/algorithms/xtoken_off_policy_distillation.py 28
nemo_rl/data/cross_tokenizer_collate.py 69, 167
tests/unit/models/value/test_automodel_value_worker.py 19, 27, 126, 258
tests/functional/grpo_automodel_ref_anchor_resume.sh 2
tests/functional/test_converter_roundtrip.py 475, 487, 489, 541, 558, 559, 563, 577, 673, 690
examples/configs/ppo_math_1B.yaml 340
examples/configs/ppo_math_1B_megatron.yaml 24
examples/configs/sft.yaml 60
examples/configs/recipes/llm/dapo-nanov3.5-30BA3B-4n8g-automodel.yaml 2
tests/unit/reference_configs/sft.yaml 54

config.py:1193 and checkpoint.py:103 are user-visible error text; the rest are comments,
docstrings and test output.

test_converter_roundtrip.py:577 is factually wrong, not just old naming. It prints
"✓ Dtensor V1 and Dtensor V2 DCP and Megatron roundtrip checkpoints are identical!", but the
test builds exactly one DCP checkpoint (STEP 2) and converts it once (STEP 4); there is no
second DCP path, and the v1 one was deleted in #4273. It should name one DCP conversion plus
the Megatron one. The other nine lines in that file are plain DTensor DCP wording.
:89 in the same file is the dtensor_cfg config key and belongs to #4283 — leave it.


Out of scope — already evaluated, do not "fix" these here

Activity

  1. self-assigned this
    on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions