Repository navigation
Repair four checks red on main - #14991
Conversation
- _xpu_triton_toolchain: the vswhere call decoded with the locale code page; name UTF-8 and ask vswhere for it (-utf8), which test_text_io_encoding requires. - test_attention_packed_fp32_routing: gate the CUDA parity test on has_real_cuda(), since torch.cuda.is_available() is spoofed on CPU CI. - test_usage_examples_model_source_contract: follow #14914, where a null model renders a YOUR_MODEL placeholder under the no-model note instead of hiding the snippet. Keeps the no-hardcoded-id invariant.
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- loader._resolve_non_vlm_auto_model: name trust_remote_code like its sibling resolvers, so test_every_resolver_probe_forwards_the_trust_decision can see the trust decision reach every class probe (#14945). - test_kill_switch_env_is_read_at_import: the fresh interpreter had no CUDA spoof, so on CPU CI import unsloth raised before the switch was read (#14936). Install the CI spoof when there is no GPU, and check both values.
|
@codex review |
|
@codex review |
# Conflicts: # unsloth/models/loader.py
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…A router chain (#2042) In unsloth's `Core zoo (HF=default + TRL=default)` job, `tests/test_pad_token_resize_not_inference.py::test_pad_token_resize_under_inference_mode_is_trainable` fails with `RecursionError: maximum recursion depth exceeded`. It happened on unslothai/unsloth#14941 and again on a staging run of unslothai/unsloth#14991. The test passes on its own. The traceback alternates between `_sdpa_maybe_muse_glimmer_banded` and `_sdpa_maybe_flash_sliding`: the two SDPA routers had ended up wrapping each other. ## Cause Each router guards against re-wrapping by reading a sentinel off the installed `ALL_ATTENTION_FUNCTIONS["sdpa"]` entry. When the Muse Glimmer router wraps gemma-4's, it copies `_unsloth_gemma4_flash` onto itself, so gemma-4 still sees its own sentinel on the next pass. `test_patch_preserves_wrapped_router_sentinels` cleans up with `vars(mg._sdpa_maybe_muse_glimmer_banded).pop("_unsloth_gemma4_flash", None)`. That is fine in a fresh process. But when the process has already installed the real chain (unsloth's import does), it strips the real sentinel. The next `TEMPORARY_PATCHES` pass then wraps gemma-4 around the Muse Glimmer router while the Muse Glimmer router still wraps gemma-4, so any SDPA model recurses. Reproduced locally: - run `tests/test_muse_glimmer_banded_attention.py`, then a test that re-runs `patch_gemma4_flash_sliding()` and `patch_muse_glimmer_banded_sliding_attention()`; - after that, `gf._ORIG_SDPA[0] is mg._sdpa_maybe_muse_glimmer_banded` and `mg._ORIG_SDPA[0] is gf._sdpa_maybe_flash_sliding`. Production does not strip the sentinel, so this is test isolation only. ## Fix - The sentinel test snapshots the wrapper's attributes and restores them exactly, instead of popping one. - New `test_sentinel_test_leaves_a_live_chain_intact`: 1. installs the real chain the way unsloth does, with gemma-4's router under the Muse Glimmer one; 2. runs the sentinel test inside it; 3. runs both patches again, and asserts neither router re-wrapped. ## Verification - `tests/test_muse_glimmer_banded_attention.py`, `tests/test_gemma4_flash_sliding.py` and `tests/test_pad_token_resize_not_inference.py`: 23 passed, 1 skipped. - The muse-then-repatch sequence above no longer produces a cycle. - Sabotage check: putting the `pop` back fails the new test.
Four checks fail on
main(fd924a5), so every open PR inherits them. Each was reproduced on a cleanmainworktree and attributed. A fifth,test_every_resolver_probe_forwards_the_trust_decision, was fixed onmainby #14990 in the meantime, so this PR takes that version.studio/backend/tests/test_text_io_encoding.py::test_text_io_names_its_encoding[_xpu_triton_toolchain.py]vswherecall usedtext=Truewith no encoding, so it decoded with the locale code page. A Visual Studio install path with non-ASCII characters would garble. It now passes-utf8to vswhere and decodes as UTF-8 (errors="replace").tests/python/test_accelerator_skip_guards.py::test_no_skip_guard_reads_a_spoofable_accelerator_probetest_packed_fp32_cuda_parityskipped ontorch.cuda.is_available(), which the CPU CI spoof answers True. It is now gated onhas_real_cuda(), same as the sibling attention tests.tests/studio/test_usage_examples_model_source_contract.py::test_examples_never_print_a_hardcoded_model_idYOUR_MODELplaceholder when nothing is servable, instead of hiding it. The test still asserted the old "no snippet" shape.tests/test_fp8_pre_sm89_byte_dequant.py::test_kill_switch_env_is_read_at_importunslothin a fresh interpreter that has no conftest spoof, so on CPU CI the import raised "cannot find any torch accelerator" before the switch was read. With no GPU, the subprocess now appliestests/_zoo_aggressive_cuda_spoof.py, the same patterntest_qat_phone_deployment.pyuses. It now checks both0and1.For the third check, the invariant is unchanged: no hardcoded
unsloth/...id and noMODEL_FALLBACK. The test now also pins the new contract:model ?? MODEL_PLACEHOLDERcall as the onlybuildSnippetscall siteVerification
mainbefore Fix test_every_resolver_probe_forwards_the_trust_decision on main #14990: 4 failed intests/and 1 failed instudio/backend/tests.test_accelerator_skip_guards.py,test_usage_examples_model_source_contract.pyandtest_attention_packed_fp32_routing.pygive 48 passed, 1 skipped. With the two new files andtest_audio_load_routing.pyadded, the run gives 94 passed, 133 skipped.test_text_io_encoding.pyandtest_xpu_triton_toolchain_14807.pygive 904 passed._HIP_FP8_BYTES_DEQUANT = Truefails the kill-switch test."unsloth/Qwen3-4B".model ? null :gate on the note.