Repository navigation
Save routing harness: define what the GGUF-packed save paths read, and guard every global the generic save loads (red on main since #20022) - #20075
Merged
Conversation
…d guard every global the generic save loads
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. Keep it up! 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". |
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
tests/saving/test_save_method_lora_routing.pyhas 18 failures onmainsince #20022 (Train LoRA on packed GGUF weights), in every Core job (HF 4.57.6 + TRL<1 and HF latest + TRL latest). The most recent staging example is #20071, which does not touch saving:The routing harness execs
unsloth_generic_savefromsave.pysource into a namespace it builds by hand. #20022 wrapped the merge in anExitStack(a module-level import) and added a GGUF-packed branch that calls_shard_bytesand reads_GGUF_PACKED_STATE_DICT_REFUSAL. The harness defines none of these, so every routing test that reaches the merge dies with aNameErrorbefore asserting anything. #20022 is correct, and the harness is behind it.Changes
ExitStack;_shard_bytesand the refusal constant;sys;save_inkling2_merged_16bit, as an overridable default that tests replace when they exercise the Inkling 2 writer.unsloth.models.gguf_packed, which the save imports lazily, is stubbed insys.modulesfor each routing test, the same wayunsloth_zoo.saving_utilsalready is. No fixture is GGUF-packed:is_gguf_packed_modelanswersFalse;gguf_dense_base_for_mergeyieldsNone, so the merge resolves its base exactly as before Train LoRA on packed GGUF weights (gguf_packed = True) #20022;write_gguf_dense_baseraises if it is ever reached._shard_bytesis listed as a stubbed helper, so the existing helper coverage check passes for the right reason.test_every_global_the_generic_save_reads_is_in_the_harness. The existing helper check only sees calls tosave.py's own functions, so it could not see a module-level import likeExitStack. The new guard walks the bytecode of the exec'dunsloth_generic_save(nested code objects included) for everyLOAD_GLOBAL, and fails if the harness namespace or builtins do not define one. A future import or constant added to the save then fails one test that names it, instead of a wall ofNameErrors.Verification
main, 18 tests fail. With this change the file passes: 112 passed, on both transformers 5.18 and 4.57.6.ExitStackfrom the harness fails the new guard withunsloth_generic_save reads ['ExitStack'], which the routing harness does not define.unsloth/save.pyis untouched.