Skip to content

Pin the tiny models of the tests that run the scripts in a child process - #8539

Merged
albertvillanova merged 3 commits into
mainfrom
pin-tiny-models-subprocesses
Nov 25, 2026
Merged

albertvillanova merged 3 commits into
mainfrom
pin-tiny-models-subprocesses

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

This PR pins the tiny models of the tests that run the training scripts in a child process, which the MODEL_REVISIONS fixture in tests/conftest.py doesn't reach: the torchrun launches of the distributed tests and the trl <command> CLI tests.

Motivation

#8262 pinned every tiny model the tests load through the transformers and PEFT loaders of the test process. The scripts launched in a child process (trl/scripts/*.py under torchrun, and trl <command>, which runs the script with subprocess on a single accelerator) load their models in another Python process, so they still loaded the Hub's main: on a release branch, they got every later tiny model update.

Solution

The tests pass the pins as script arguments: --model_revision, and --teacher_model_revision for distillation. A reward model given by name doesn't take the policy's revision (#8532), so the GRPO and RLOO tests pass the reward model as a local snapshot of its pin.

MODEL_REVISIONS and its update procedure move from tests/conftest.py to tests/testing_utils.py, so the test modules can import them.

The distributed tests that run pytest under torchrun (async GRPO and async distillation) already load tests/conftest.py in their child processes, so they were pinned already.

Changes

  • Move MODEL_REVISIONS and its procedure from tests/conftest.py to tests/testing_utils.py, and point the generator README there
  • Pass the pinned revisions in the 10 script launches of tests/distributed/test_distributed.py and the 9 trl <command> tests of tests/test_cli.py
  • Pass the GRPO and RLOO reward model as a local snapshot of its pin

Verified: tests/test_cli.py (58 passed, 1 H100) and the 10 script launches of the distributed tests with DDP (10 passed, 2 B300).


Note

Low Risk
Test and docs-only changes that make CI more deterministic; no production training or library behavior changes.

Overview
Child-process tests (distributed torchrun script launches and trl <command> CLI runs) now pass pinned Hub commits because they don't use the conftest revision monkeypatch.

MODEL_REVISIONS moves from tests/conftest.py to tests/testing_utils.py so test modules can import it; conftest still imports the dict for in-process auto-injection, and docs/README point maintainers at testing_utils.py.

Distributed script tests add --model_revision for the policy model on all ten training-script invocations. GRPO/RLOO reward models use snapshot_download at the pinned revision and pass a local path (hub id alone would still load main, #8532).

CLI integration tests add --model_revision (and --teacher_model_revision for distillation), plus the same local reward-model snapshot pattern for GRPO/RLOO; YAML config test includes model_revision.

Reviewed by Cursor Bugbot for commit 630a577. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Nov 23, 2026
@qgallouedec
qgallouedec requested a review from kashif November 24, 2026 05:12
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@albertvillanova
albertvillanova merged commit 620c249 into main Nov 25, 2026
11 of 12 checks passed
@albertvillanova
albertvillanova deleted the pin-tiny-models-subprocesses branch November 25, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants