Skip to content

Load the real loader_utils helpers into the precision conflict test harness - #14545

Merged
danielhanchen merged 1 commit into
mainfrom
fix-precision-conflicts-loader-utils
Oct 21, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-precision-conflicts-loader-utils

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Repo tests (CPU, rest) is red on main since #14516: 7 cases in tests/test_optimized_precision_conflicts.py fail with

unsloth/models/loader.py:1811: in from_pretrained
    _fp8_dequantize_config = _fp8_dequantize_quantization_config(model_config)
E   NameError: name '_fp8_dequantize_quantization_config' is not defined

The product is fine: loader.py imports the helper from .loader_utils. The test rebuilds FastLanguageModel.from_pretrained from source inside a hand-written namespace of stubs, and #14516 added a call that namespace did not have. Seen on #14538's run (job 119354809171).

Change

Instead of adding one more stub, the fixture now also loads the real definitions of the .loader_utils functions that loader.py imports and from_pretrained references, for any name it does not already stub. They are compiled with postponed annotations so signatures such as Union[...] do not need their typing imports. Existing stubs win, so every current fixture behaves as before; the next helper a PR adds to that import list is picked up without touching this test.

For these fixtures the real _fp8_dequantize_quantization_config sees a config with no quantization_config and returns None, which is exactly what a non-fp8 checkpoint does.

Testing

  • CPU torch 2.10, transformers 5.17: main 7 failed / 12 passed; this branch 19 passed.
  • Sabotage: making the real _fp8_dequantize_quantization_config raise fails the same 7 cases with that error, so they run the real helper rather than a stub.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T17:57:31.677669Z bec8579 Manual request
🔒 Security Review ⚠️ Failed 2026-10-21T17:55:29.688273Z
We couldn’t complete this review. Comment @codex security review to try again.
bec8579 PR opened
ℹ️ 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

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: bec857911e

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

@danielhanchen
danielhanchen merged commit ce1ab5b into main Oct 21, 2026
@danielhanchen
danielhanchen deleted the fix-precision-conflicts-loader-utils branch October 21, 2026 18:01
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