Repository navigation
Saving routing tests: stub the NF4 dequant cache release - #18367
Merged
Merged
Conversation
#18285 has unsloth_save_model call _release_nf4_dequant_cache() first to free the training-time NF4 dequant cache before a merge. The routing harness execs unsloth_save_model into its own namespace, which lacked the helper, so 6 tests fail on main with NameError. Add a no-op default next to the harness's other always-called save helpers.
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. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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
Six tests in
tests/saving/test_save_method_lora_routing.pyfail on main in every Core job (HF default, 4.57.6 and latest):Seen on the staging runs for #17742 and #18256, both on current main.
Cause
#18285 has
unsloth_save_modelcall_release_nf4_dequant_cache()first, so a merge gets back the memory the training-time NF4 dequant cache held. That is correct. The helper is deliberately module-level, becauseunsloth_save_modelforwards its ownlocals().This test does not import
unsloth/save.py. It execs the named functions into a namespace that_load()builds, pre-stubbing the helpers every save path calls (_unmerge_flags_on_error,lora_relative_to_original_base, and so on). The new helper was not in that namespace.Fix
Add
_release_nf4_dequant_cacheas a no-op default in_load(), next to the other always-called save helpers. None of these fixtures has a dequant cache to free.Verification
tests/saving/without the model-loadingtest_unsloth_save.py:test_torchao_remote_code_consent.py::test_compressed_and_gguf_lora_paths_drop_auto_map_trust)The torchao test fails identically on both sides on this host and does not fail in CI, so it is unrelated.
test_save_method_lora_routing.pypasses 80 out of 80. ruff is clean.