Repository navigation
Pin the tiny models of the tests that run the scripts in a child process - #8539
Merged
Merged
Conversation
kashif
approved these changes
Nov 24, 2026
…processes # Conflicts: # tests/conftest.py
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR pins the tiny models of the tests that run the training scripts in a child process, which the
MODEL_REVISIONSfixture intests/conftest.pydoesn't reach: thetorchrunlaunches of the distributed tests and thetrl <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/*.pyundertorchrun, andtrl <command>, which runs the script withsubprocesson a single accelerator) load their models in another Python process, so they still loaded the Hub'smain: 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_revisionfor 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_REVISIONSand its update procedure move fromtests/conftest.pytotests/testing_utils.py, so the test modules can import them.The distributed tests that run
pytestundertorchrun(async GRPO and async distillation) already loadtests/conftest.pyin their child processes, so they were pinned already.Changes
MODEL_REVISIONSand its procedure fromtests/conftest.pytotests/testing_utils.py, and point the generator README theretests/distributed/test_distributed.pyand the 9trl <command>tests oftests/test_cli.pyVerified:
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
torchrunscript launches andtrl <command>CLI runs) now pass pinned Hub commits because they don't use theconftestrevision monkeypatch.MODEL_REVISIONSmoves fromtests/conftest.pytotests/testing_utils.pyso test modules can import it;confteststill imports the dict for in-process auto-injection, and docs/README point maintainers attesting_utils.py.Distributed script tests add
--model_revisionfor the policy model on all ten training-script invocations. GRPO/RLOO reward models usesnapshot_downloadat the pinned revision and pass a local path (hub id alone would still loadmain, #8532).CLI integration tests add
--model_revision(and--teacher_model_revisionfor distillation), plus the same local reward-model snapshot pattern for GRPO/RLOO; YAML config test includesmodel_revision.Reviewed by Cursor Bugbot for commit 630a577. Bugbot is set up for automated code reviews on this repo. Configure here.