Skip to content

Load #11526's text-core refusal in the save_method routing harness - #12077

Merged
danielhanchen merged 1 commit into
mainfrom
lora-routing-harness-loads-text-core-guard
Sep 27, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
lora-routing-harness-loads-text-core-guard

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The Core jobs (HF=latest + TRL=latest, HF=default + TRL=default) fail on main-based PRs, for example #12065:

FAILED tests/saving/test_save_method_lora_routing.py::test_an_adapter_save_never_reaches_the_merge[lora] - NameError: name '_refuse_unsaveable_text_core' is not defined

This reproduces on main at c807acbf4: the three [lora] cases, the four test_every_other_method_still_merges cases, test_a_model_with_no_adapter_is_unchanged and test_none_is_normalised_before_the_merge_is_reached.

Cause

These tests do not import unsloth.save. They exec unsloth_generic_save, plus a listed set of helpers, against fakes. #11526 (b53a6d7a4) added a _refuse_unsaveable_text_core(model, save_method) call at the top of unsloth_generic_save. It updated the equivalent harness in tests/test_merged_hub_destination.py but not this one, so every routed save raises NameError.

The product is fine. The helper exists and is correct, and only the harness's list of helpers is out of date.

Fix

  • The helpers the harness runs as real code are now one tuple: _normalize_safe_serialization, _is_adapter_save_method, _honours_safe_serialization, _refuse_unsaveable_text_core.
  • The helpers it stubs are a second set. _qwen3_5_vlm_state_dict_for_save gets a stub that raises if reached; _is_qwen3_5_vlm is already stubbed to False.
  • New guard test_every_helper_the_generic_save_calls_is_loaded_or_stubbed: it walks unsloth_generic_save with ast and requires every save.py function it calls to be in one of the two lists, and every listed name to still be called. The next helper added there fails with its name instead of a NameError across the whole file.

Verification

  • The file passes in full: 56 passed.
  • Dropping _refuse_unsaveable_text_core from the tuple brings back the CI NameError in the routing tests, and the guard fails with: unsloth_generic_save calls ['_refuse_unsaveable_text_core'] from save.py, which the routing harness neither loads nor stubs.

The routing tests exec unsloth_generic_save against fakes with a listed set of
save.py helpers. #11526 added a call to _refuse_unsaveable_text_core and
updated test_merged_hub_destination's harness but not this one, so every
routing test raised NameError in the Core jobs. Load it (and
_honours_safe_serialization) as real code, stub the Qwen3.5 VLM state dict
helper the harness never reaches, and add a guard that names any save.py
helper the generic save calls that the harness neither loads nor stubs.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 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-09-27T04:02:25.060322Z 1881ac2 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. Hooray!

Reviewed commit: 1881ac2d3a

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 27, 2026
@danielhanchen
danielhanchen merged commit f367878 into main Sep 27, 2026
17 of 18 checks passed
@danielhanchen
danielhanchen deleted the lora-routing-harness-loads-text-core-guard branch September 27, 2026 04:05
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…arness (unslothai#12077)

The routing tests exec unsloth_generic_save against fakes with a listed set of
save.py helpers. unslothai#11526 added a call to _refuse_unsaveable_text_core and
updated test_merged_hub_destination's harness but not this one, so every
routing test raised NameError in the Core jobs. Load it (and
_honours_safe_serialization) as real code, stub the Qwen3.5 VLM state dict
helper the harness never reaches, and add a guard that names any save.py
helper the generic save calls that the harness neither loads nor stubs.
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