Repository navigation
Studio: default export load to offload_layers=auto - #13720
Merged
danielhanchen merged 4 commits intoOct 14, 2026
Merged
danielhanchen merged 4 commits into
danielhanchen merged 4 commits into
Conversation
Export checkpoint loading never passed Unsloth's offload_layers, so low-VRAM Output exports hit bitsandbytes CPU-spill while Training already supported Auto (unslothai#13696). Plumb the same kwarg through the export API and default it to auto so models that fit with layer offload can export.
Retry a single-GPU 4-bit export load that bitsandbytes refuses with offload_layers='auto' and a 1 GiB merge reserve instead of a training step's, so loads that fit stay unchanged. Match Unsloth's rewritten CPU-spill error via __cause__, carry base_model and offload_layers into the load retries, and keep offload_layers keyword-last.
Member
|
@codex review |
1 similar comment
Member
|
@codex review |
Codex Review SummaryThis 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. 🚀 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
offload_layers="auto"load work.offload_layers="auto", keeping the layers the GPU cannot hold in host RAM. The retry plans a 1 GiB merge reserve instead of a training step's, since export trains nothing._is_cpu_spill_rejectionnow also matches Unsloth's rewritten "does not fit in GPU memory" error (it keeps the original as__cause__), so the existing multi-GPU fallback recognises it too. Both retries carrybase_modelandoffload_layersthrough.LoadCheckpointRequest.offload_layers(default"auto",0disables the retry, an integer is passed through as Training does) is plumbed route -> orchestrator -> worker ->ExportBackend.load_checkpoint, as a trailing keyword so existing positional callers are unaffected. No UI change.Testing
ExportBackendwith the card limited to 6.84 GiB free:Failed to load checkpoint: Unsloth: unsloth/gemma-4-E2B-it-unsloth-bnb-4bit does not fit in GPU memory (cuda:0 has 6.80 GB free) ...offload_layers, no planner kwargs).pytest studio/backend/tests/test_export_*.py studio/backend/tests/multi_account; the new retry tests fail on main and pass here.