Repository navigation
Precision conflict test: lift mapper.py helpers (red since #18061) - #18096
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. Nice work! 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 17, 2026
… -bf16 check by its new call (10 failures since #18061) (#18110) `tests/python/test_loader_resolution_reporting.py` has 10 failures on main in the CPU `studio` shard since #18061 (seen on the staging runs of #18084 and #18087): ``` unsloth/models/loader.py:1555: in <module> if bf16_repo_loads_16bit(model_name, load_in_16bit): E NameError: name 'bf16_repo_loads_16bit' is not defined test_adapter_base_resolution_updates_report_before_base_config_load[*] E StopIteration ``` This is the same root cause as #18096, in a second harness that test did not cover. ## Cause The test runs slices of the real `from_pretrained` bodies in a hand-built scope. #18061 moved the inline `model_name.lower().endswith("-bf16") and (...)` check into `mapper.bf16_repo_loads_16bit`, which is correct, but: - the scopes do not define `bf16_repo_loads_16bit`, so 8 cases die with `NameError`; - the adapter test found the end of its slice by the `if model_name.lower().endswith(...)` statement in the `is_peft` block, which no longer exists, so `next()` raises `StopIteration`. ## Fix - `_mapper_function` lifts the real `bf16_repo_loads_16bit` out of `mapper.py` by AST (the file deliberately avoids importing unsloth), and each scope gets it, so the check runs for real instead of being stubbed. - `_is_bf16_check` finds the slice end by either form (the helper call or the old inline check). ## Verification - main: 10 failed, 2 passed. - this branch: 12 passed.
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.
tests/test_optimized_precision_conflicts.pyhas been red on main (19 failed, both therestandstudioCPU shards) since #18061 (c0ef23b).Cause
The
loaderfixture runs the realFastLanguageModel.from_pretrainedbody in a stub namespace. It lifts the loader.py helpers and the.loader_utilsfunctions the method calls, but nothing from other sibling modules. #18061 madefrom_pretrainedcallbf16_repo_loads_16bit, importedfrom .mapper, so every case now dies withNameError: name 'bf16_repo_loads_16bit' is not definedbefore reaching the precision checks.The loader change is correct; the harness just did not know about
.mapper.Fix
_loader_utils_functionstakes the module name, and the fixture lifts real definitions from each module in_LIFTED_MODULES = ("loader_utils", "mapper"). Only functions thatfrom_pretrainedboth imports and calls are lifted, and explicit stubs still win, as before. A later helper added tomapper.pyis picked up without touching the test.Verification
19 failed(NameError).19 passed._LIFTED_MODULES = ("loader_utils",)the file goes back to19 failed.