Repository navigation
Studio: stop the Load Model panel flagging Auto context loads as over VRAM - #12555
Merged
danielhanchen merged 4 commits intoOct 3, 2026
Merged
Conversation
Member
Author
|
Reached Codex review convergence at oobabooga#329. |
Member
|
The reds on this head are all main's and are fixed on main as of today: |
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 3, 2026
JoshuaL3000
pushed a commit
to JoshuaL3000/unsloth
that referenced
this pull request
Oct 4, 2026
… VRAM (unslothai#12555) * Studio: stop the Load Model panel flagging Auto context loads as over VRAM * Drop the shorter-context hint from the over-VRAM warnings * Keep the estimate route answering while a fit flag is half typed * Trim estimate-memory comments --------- Co-authored-by: Daniel Han <[email protected]>
danielhanchen
added a commit
that referenced
this pull request
Oct 29, 2026
…y host (#16014) ## Summary Five tests in `studio/backend/tests/test_memory_estimate.py::TestAnAutoContextIsMarkedShrinkable` fail on any Apple Silicon host. The regular CI does not run this file on macOS, so they surface when a PR touching memory estimation gets a macOS leg (the staging xplat run for #15970 on `macos-26`; that PR changes only the MLX estimate): ``` test_an_unnamed_context_is_priced_at_the_fit_floor[request_fields0-True-8192] assert shorter.gpu_bytes < resp.gpu_floor_bytes == floor.gpu_bytes < resp.gpu_bytes E assert 18402857 < 18402857 test_tensor_mode_takes_the_layer_fallback_floor[None] E assert 1102368297 == 1264897577 ``` Since #12555, `_estimate_context_floor` uses `_FIT_FLOOR_MIN_CTX` (256) on Apple Silicon, where Metal reprices down to the smallest context it searches, and `_FIT_MIN_CTX` (8192) for a layer split elsewhere. `TestTheContextFloorFollowsThePlacementPath` pins both paths explicitly; this class assumes the layer-split one but reads the real host, so on a Mac its auto-mode floor is the 256 context it compares against. The product is right; the class never said which host it prices. Reproduced on main on Linux with `is_apple_silicon()` forced to `True` (the macOS runner's answer): the same 5 fail. ## What changed The class's autouse fixture pins `utils.hardware.is_apple_silicon` to `False`, with a comment pointing at the class that covers Metal. ## Verification - Main with `is_apple_silicon()` forced `True`: 5 failed in this class. - Head, same forcing: this class and `TestTheContextFloorFollowsThePlacementPath` 39 passed. - Head on Linux: `tests/test_memory_estimate.py` 283 passed, 98 skipped. - With `_FIT_MIN_CTX` changed from 8192 to 4096, 7 tests in this class fail, so it still pins the layer-split floor.
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.
With Context Length on Auto, the Load Model panel estimates a GGUF at its full native context and can warn "Exceeds GPU memory. Try Auto context", even though Auto is already selected and the loader can shrink the context to fit. A user with an 8 GB card reported this on Reddit.
The estimate now reports whether context can shrink, its GPU memory floor, and whether layers can move to the CPU. The panel uses that floor for Auto's fit verdict and explains context reduction, CPU offload, or possible failure. Free-memory pressure takes precedence. Displayed figures, pinned-context warnings, and verdicts from older backends remain unchanged.
The floor follows the launch settings. Tensor requests conservatively use the larger of the tensor and layer-fallback footprints at 8,192 tokens, preserving the device count for both automatic and explicit GPU selection. Host memory stays estimated at native context.
Screenshots
Main at
364a42f02fversus this branch, using Qwen3-8B Q4_K_M. GPU capacities are simulated; model memory estimates are real.Auto on an 8 GB card: the 5.92 GiB floor fits.
Auto on a 6 GB card: the floor exceeds the budget, so the note explains CPU offload.
Pinned at 40,960 tokens: the warning remains.
Validation
Limitations
The two-GPU fallback, Windows, macOS, ROCm, and desktop app were not tested on hardware. The Metal floor has unit coverage only. Conservative estimates can still warn unnecessarily for tensor loads that fit below 8,192 tokens or large CPU-resident draft caches that shrink with context.
Before / after (merge base 364a42f vs c44cc5c)
Run settings for Qwen3-8B Q4_K_M with Context Length on Auto, GPU capacity simulated as an 8 GB card in the browser; the memory estimate is the real backend's on both sides. Before, the panel flags 10.45 GiB as over VRAM; after, the same figure carries the Auto context note.