Skip to content

Loader resolution test: run mapper.bf16_repo_loads_16bit and find the -bf16 check by its new call (10 failures since #18061) - #18110

Merged
danielhanchen merged 1 commit into
mainfrom
ci-loader-resolution-bf16-helper
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-loader-resolution-bf16-helper

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T07:46:21.814118Z de244ef Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: de244ef2fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant