Repository navigation
Inkling 2: partly disable compile through the shared helper - #19073
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. Another round soon, please! 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". |
danielhanchen
added a commit
that referenced
this pull request
Nov 23, 2026
…le helper (#19133) ## Problem Two tests are broken on `main`. 1. **`tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding`** is red in `Repo tests (CPU, rest-2)` for every PR based on `main`, for example #19122: ``` Left contains one more item: 'tests/test_inkling2_support.py:633: read_text()' ``` #19016 added `(_ROOT / "unsloth" / "save.py").read_text()`. It reads a checked-in file with the platform default encoding, which breaks on Windows as soon as `save.py` gains a non-ASCII byte. The guard is right and the new line is wrong. 2. **`tests/test_inkling2_support.py::test_fastmodel_keeps_inkling2_eager_unless_told_otherwise`** fails wherever the file runs: ``` assert re.search('if os\\.environ\\.get\\("UNSLOTH_COMPILE_DISABLE", "0"\\) == "0": ...', body) AssertionError: None ``` It still pins the inline assignment that #19073 replaced with the shared `_set_partial_compile_disable()` helper. CI does not show it yet: the file skips below transformers 5.24, and the HF=latest legs are held below 5.24. It fails locally on 5.24.0, so it would turn red as soon as that cap lifts. ## Fix Tests only, in `tests/test_inkling2_support.py`: - Both reads of checked-in source pass `encoding = "utf-8"`: - the `save.py` read the guard flags; - the loader source read through `__file__`, which the guard does not see. - The eager-compile test now pins the current shape: - the Inkling 2 branch calls `_set_partial_compile_disable()`; - the helper sets `partial` from unset, `0` or `partial`; - the helper keeps a full disable (`1`, `true`) as `1`, so an explicit user choice is still left alone. ## Verification | Check | Result | | --- | --- | | `test_source_read_encoding.py`, `main` | 1 failed | | `test_source_read_encoding.py`, this branch | 16 passed | | `test_inkling2_support.py`, transformers 5.24.0, `main` | 1 failed, 41 passed | | `test_inkling2_support.py`, transformers 5.24.0, this branch | 42 passed | | `test_inkling2_support.py`, transformers 5.17 | module skipped as before | Sabotage, each with only the product line changed: - Drop the helper call from the Inkling 2 branch in `loader.py`: the test fails on the call check. - Make the helper always set `partial`: the test fails with `assert 'partial' == '1'` for a full disable.
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.
Summary
Repo tests (CPU, rest)fails onmain:Root cause
The Inkling 2 branch, not the guard. #18773 added
_set_partial_compile_disable()tounsloth/models/loader.pyand routed every branch that partly disables compile through it, with a guard that no other code writes"partial". The Inkling 2 branch from #18812 / #18959 landed alongside it with its own direct write:Besides tripping the guard, that write keeps a value like
trueoryesas it is, and unsloth_zoo only reads"1"and"partial"as off, soUNSLOTH_COMPILE_DISABLE=trueleft Inkling 2 compiled. The helper turns1/true/yesinto"1"and everything else into"partial".Fix
unsloth/models/loader.py: the Inkling 2 branch calls_set_partial_compile_disable(). Unset or0still becomespartial, and1still stays fully off.tests/test_loader_compile_disable_preserve.py: the helper-call count goes from five branches to six, with Inkling 2 named.Testing
tests/test_loader_compile_disable_preserve.pyandtests/test_inkling2*.py: 23 passed, 3 skipped.main'sloader.py, the guard fails (both the direct write and the helper count).0,false->partial;1,true->1;partial->partial.