Repository navigation
tests: skip two version_compat suites where the daily sweep has no torch - #12274
Merged
danielhanchen merged 3 commits intoOct 5, 2026
Merged
danielhanchen merged 3 commits into
danielhanchen merged 3 commits into
Conversation
daily-fresh-fetch in version-compat-ci.yml runs all of tests/version_compat/
after installing nothing but pytest. The other suites there that need torch
skip in that job, eight of them on a module-scope find_spec("torch") guard, and
two of those say why: "daily-fresh-fetch collects this directory with only
pytest installed." test_trl_config_defaults_contract.py (unslothai#12069, unslothai#12088) and
test_pref_max_length_clamp.py (unslothai#12069) have no guard. They pass in
grpo-fake-run, which installs torch, and in the sweep every `import unsloth`
stops at unsloth/_gpu_init.py's `import numpy`.
The sweep passed daily up to 2026-09-26 and has failed daily since unslothai#12069
merged: 43 failed on 09-28 and 09-29, all 43 in these two files on that
ModuleNotFoundError. The 09-27 run exited 1 and its log has expired.
The defaults contract imports unsloth in every test, so it takes its
neighbours' guard at module scope. In the clamp file seven tests read rl.py as
text and still run in the sweep, so only test_patched_trainer_carries_the_clamp,
which imports unsloth and trl, is guarded.
test_the_daily_sweep_skips_what_it_cannot_import runs every suite the sweep
collects outside the pip-free bundle in a subprocess with torch, numpy,
transformers, trl, peft, accelerate and unsloth_zoo hidden, and fails on any
test that fails rather than skips. workflow-trigger-lint runs that file on
every pull request with no torch installed, so a suite added without the guard
now fails its own pull request instead of the next morning's cron. It fails on
main with the sweep's 43 tests and passes here.
One consequence worth naming: the new test adds about 2 s to
workflow-trigger-lint on every pull request, measured in that job's environment.
This was referenced Oct 5, 2026
Member
|
Review record for #12274, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#412. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
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.
Follows up #12069 and #12088.
The failure
Version Compat CI's daily fresh-fetch sweep (cron only) has failed on every scheduled run since #12069 merged (2026-09-27 05:15 UTC). It passed every day from 09-20 to 09-26.f442c7abf08f3dff19, the first with #120698fb2fa34d6c20f0facAll 43 are in two files, 41 in
test_trl_config_defaults_contract.pyand 2 intest_pref_max_length_clamp.py, and each one stops at the same line:Why
The sweep installs nothing but pytest, then runs the whole directory:
The other suites there that need torch skip in that job, eight of them on a module-scope
find_spec("torch")guard. Two carry the reason beside it (test_trl_loss_normalization_contract.py:43):The two files #12069 added, and #12088 extended, have no guard. They are wired into
grpo-fake-run, which installs torch and TRL, and they pass there: on6c20f0facthe contract file ran 39 passed and 2 skipped, and the clamp file 9 passed, in each TRL step. The sweep collects them too, and there everyimport unslothfails.The change
test_trl_config_defaults_contract.py: every test imports unsloth, so the file takes its neighbours' guard at module scope.test_pref_max_length_clamp.py: seven of its tests readrl.pyas text and pass in the sweep today, so onlytest_patched_trainer_carries_the_clamp, which imports unsloth and trl, is guarded.tests/studio/test_version_compat_bundle.py: one test, so that this class fails on the pull request that introduces it rather than on the next morning's cron.Nothing under
unsloth/or.github/changes.Tests
test_the_daily_sweep_skips_what_it_cannot_importNoneentry insys.modulesmakesimportraise andfind_specanswerNone, as they do in the sweepIt sits beside the other assertions about this workflow.
workflow-trigger-lint.ymlruns that file on every pull request, with no path filter and nothing installed but pytest, PyYAML, xdist and vermin. The bundle's own suites are left out: they install nothing by construction, already run on every pull request, and fetch from the network.Verified
Each row was run on
main2033855cdand on this branch.mainpip install 'pytest>=8'(pytest 9.1.1), then its pytest line6c20f0facmain), its env and its pytest linetest_version_compat_bundle.py,-n 4,workflow-trigger-lint's installworkflow-trigger-lint's whole guard step, its installtest_release_desktop_appimage.py::test_apprun_falls_back_to_the_shipped_font_policy_when_it_cannot_writeruff check0.15.18 andscripts/run_ruff_format.pyon the three filesOne consequence worth naming
The new test starts a second pytest, so it adds about 2 s wherever this file runs: 2.0 s measured in
workflow-trigger-lint's environment, 1.8 s with torch installed.Not in scope
CRON_ONLYintest_version_compat_bundle.pysays its two suites are "checked daily rather than never". In the sweep neither runs its real check:test_trl_vllm_generation_lora_patch.pyskips at module scope (torch not installed; this test drives the real patch), andtest_importing_the_cpu_modules_leaves_torch_globals_aloneskips (torch not installed; there is no global state to protect). No other job names either file, so today both checks run nowhere. Where they should run is a CI decision, so this leaves them alone.needs unsloth: No module named 'numpy'), and its dtype-kwarg check imports onlyast,pathliband pytest. None of them would fail the new test for want of torch.