Repository navigation
Repair the four checks that are red on main itself - #11216
danielhanchen wants to merge 3 commits into
Conversation
… the shared lock Repo tests (CPU, python) is red on main. Two causes, neither of them a PR's. test_accelerator_skip_guards fails on the two files #11038 added: both gate on a bare torch.cuda.is_available(), which tests/_zoo_aggressive_cuda_spoof.py patches to True process-wide, so they un-skip on a CPU-only box and try to load a real checkpoint. Gated on the probes that test names, has_real_cuda() for the one that asks for a cuda device and has_real_accelerator() for the one that does not. All 24 guard tests pass; the two files still collect, 76 passed. The second is a flake, and it is the one that cost this job a red run. studio.py resolves STUDIO_HOME once at import, and update() takes a NON-BLOCKING flock on the single .studio-runtime.lock beneath it. Left at the real ~/.unsloth/studio that file is shared by every xdist worker: STUDIO_HOME: ~/.unsloth/studio lock: ~/.unsloth/studio/.studio-runtime.lock second holder -> StudioRuntimeGateBusy -> typer.Exit(1) which is exactly how test_non_windows_preserves_call_order_without_launcher_operations died on gw3 with nothing wrong. _configure_windows already redirected it; the tests that build their own environment did not. Redirecting in the fixture covers both. Measured: before, the run creates the real lock file; after, it never appears.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…esolve its import Two more checks that are red on main itself, both from PRs that landed today. Repo tests (CPU, studio) and workflow-trigger lint: #10533 put 'Bitdefender' in install.ps1 and studio/setup.ps1. test_installer_av_shapes refuses that, and the reason is in its own header: PowerShell hands the entire top-level script block to AMSI at compile time, so comments are classifier input, and VirusTotal quoted one of our own comments back as grounds for suspicion. The comment still says the thing that matters, that the feature is not Defender-only and the user has to be told which product to open; the vendor name moves to AV_SHAPES_RECORD where the file's own rule says it belongs, with #10533 as the anchor, so the knowledge is moved rather than deleted. Repo tests (CPU, rest): every behavioural test in test_st_save_merged_signature died with KeyError: "'__name__' not in globals". #11067 deferred the relative import of _is_adapter_save_method into _save_pretrained_merged, and the harness execs that closure into a bare dict, which a relative import has nothing to resolve against. Given a package to be relative to, and the real predicate lifted out of unsloth/save.py by the same source extraction the file already uses for _normalize_save_method. That unmasked a stale expectation the KeyError had been hiding: test_the_forwarding_path_still_accepts_lora asserted that "lora" is forwarded when modules.json is present, and #11067 deliberately made it an error on that path too, for a different reason than the no_modules branch. Rewritten to assert the refusal it actually has, and to check it refuses before merging, before writing, and without forwarding.
c0f97e3 to
6840c66
Compare
Source lint: HOISTED-IMPORT-UNUSED 'torch' was used before, now unused. torch.cuda.is_available() in the skipif was the file's only use of it, and that call is what the guard fix replaced.
|
All three are behavioural assertions about the llama.cpp cache preflight that #10533 added today, and they sit inside the The only reason this PR sees it is that it edits So it needs a fix of its own, on a Windows host where the rename path can actually be exercised, rather than a guess from here. Flagging it rather than folding it in: this PR is the four checks that are red on every PR, and that one is red only on a PR that touches the installer. |
|
Result on this branch. The four this PR is about:
The rest of the red on this branch is shared with every other open PR,
|
|
Heads up: parts of this landed on Already on
Not on Apologies for the collision - I was triaging the same main-reds from the CI side and did not check the full open-PR list before opening #11222, only the batch I was driving. A rebase should drop most of the diff. |
|
Closing this as superseded: every fix here is already on The two skip guards ( the narrow probe for the one that allocates on The shared runtime lock is redirected in the fixture on The vendor name is gone from both shipped scripts (
All four suites green on Nothing here is worth rebasing on top of that. |
Summary
Four checks are red on
mainitself:Repo tests (CPU, python),Repo tests (CPU, rest),Repo tests (CPU, studio)andworkflow-trigger lint. Every open PR inherits all four. Same shape as #11139 and #11207; every cause below landed onmaintoday, and none of it belongs to any PR that is now failing because of it.Reproduced on a clean checkout of
mainwith no PR content at all, which is how each was attributed:1. Two skip guards read a probe the spoof patches process-wide
test_no_skip_guard_reads_a_spoofable_accelerator_probe:Both files came in with #11038.
tests/_zoo_aggressive_cuda_spoof.pypatches that probe to True process-wide, so on a CPU-only runner both tests un-skip and try to load a real checkpoint throughFastLanguageModel.Gated on the probes that failing test names, and on the distinction its sibling
test_no_cuda_only_test_is_gated_on_the_broad_accelerator_probeenforces:has_real_cuda()fortest_apply_qkv_fallback_end_to_end, which asks for a cuda device, andhas_real_accelerator()for the other, which does not. Gating the first on the broad probe instead trips that sibling, correctly, since it is also true on an XPU-only or Ascend-only host.2. A launcher test takes the real, shared runtime lock
Observed red on #11126, job 104949989945:
unsloth_cli/commands/studio.pyresolvesSTUDIO_HOMEonce, at import, and_studio_runtime_launch_guardtakes a non-blockingflockon the one.studio-runtime.lockbeneath it. Left at the real~/.unsloth/studiothat file is shared by every xdist worker, so two tests in this shard that reachupdate()together collide and the loser exits 1 on a machine where nothing is wrong. Confirmed rather than inferred:_configure_windowsalready redirected it totmp_path; the tests that build their own environment, including the one that failed, did not. Moved into thestudiofixture. Measured either side, with the real lock deleted first:~/.unsloth/studio/.studio-runtime.lockafter the file runs3. A vendor name in two shipped PowerShell scripts
#10533 put
Bitdefenderininstall.ps1andstudio/setup.ps1.test_installer_av_shapes.pyrefuses that, and the reason is in its own header: PowerShell hands the entire top-level script block to AMSI at compile time, so comments are classifier input, and VirusTotal's analysis ofinstall.ps1quoted one of our own comments back as grounds for suspicion.The comment keeps the part that matters, that controlled folder access is not Defender-only and the user cannot act on advice that does not name the product holding the lock, and points at the record. The vendor name moves into
AV_SHAPES_RECORDwith#10533as the anchor, which is whattest_the_record_survives_and_keeps_its_evidenceexists to require: the ban must be satisfied by moving the knowledge, not deleting it.4. The sentence-transformers probe cannot resolve a deferred relative import
Every behavioural test in
test_st_save_merged_signature.pydied withKeyError: "'__name__' not in globals"at<string>:21.#11067 deferred
from ..save import _is_adapter_save_methodinto_save_pretrained_merged, to keep theunsloth.saveimport cycle closed. The harness execs that closure into a bare dict, on purpose, so that calling it imports no unsloth. A relative import then has no__name__or__package__to resolve against.Given a synthetic package to be relative to, and the real predicate lifted out of
unsloth/save.pyby the same source extraction the file already uses for_normalize_save_method. Nothing is stubbed: anything else the closure defers later still fails loudly on a missing attribute rather than passing against a fake.That unmasked a stale expectation the
KeyErrorhad been hiding.test_the_forwarding_path_still_accepts_loraasserted that"lora"is forwarded whenmodules.jsonis present; #11067 deliberately made it an error on that path too, for a different reason than theno_modulesbranch, and said so in the source:The test now asserts the refusal it actually has, and that it refuses before merging the adapters away, before writing a half-finished directory, and without forwarding the request on. Worth noting on its own: the file was red for a harness reason, so the disagreement underneath it was never reached by anybody.
Checks
tests/python/test_accelerator_skip_guards.py: 24 passed.tests/test_apply_qkv_fallback.py tests/test_lora_dropout_patch_summary.py: still collect, 76 passed, 2 deselected.tests/studio/test_installer_av_shapes.py: 242 passed, 1 skipped.tests/test_st_save_merged_signature.py: 28 passed.tests/pythonfiles that touch the runtime gate,-n 8: 99 passed, 32 skipped.Repo tests (CPU, rest)selection,-n 12: 7788 passed, 162 skipped, 0 failed.