You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unsloth
Unsloth Version
v0.1.49-beta
Package Version
2026.7.3
llama.cpp Version
b10019-mix-bd6aa58
GPUs
W7900
W7500
Just like the titles say; according to HWINFO, the models keep leaving VRAM when they are idle. Causing additional time (and extra RAM usage) for the model to respond as it transfers from RAM back into VRAM. There should be options to not even load it into RAM and just keep it in VRAM unless it is unloaded.
This is what I do with LM Studio to save ram (even though I have 128GB, I am often using alot of it).
Also there should be an option to use each GPU or not, as right now there is no option to select the GPUs where unsloth will run on, so sometimes it uses both it seems.
Hi, I've implemented backend support for both GPU selection and memory placement mode on GGUF models. Here's what was done:
Changes
GPU Selection (gpu_ids)
Removed the 400 error that previously rejected gpu_ids for GGUF models.
gpu_ids are now validated via resolve_requested_gpu_ids and passed through to LlamaCppBackend.load_model.
The visible GPU list is filtered to the requested IDs before auto-selection / tensor split planning.
Explicit GPU pinning is preserved even when --fit fallback kicks in.
For Vulkan builds, physical gpu_ids are translated to compact Vulkan ordinals (Vulkan0..N).
Memory Placement (gguf_memory_mode)
Added a new first-class field gguf_memory_mode with three modes:
auto (default) — normal memory-mapped loading.
pinned — locks pages in RAM via --mlock.
resident — loads fully into RAM via --no-mmap --mlock.
None, "", and "auto" are canonicalized as equivalent to avoid spurious reloads.
Inherited --mlock / --no-mmap from llama_extra_args are shadowed when gguf_memory_mode is set, so the first-class field always wins.
Both _already_in_target_state and _request_matches_loaded_settings now compare memory_mode, so changing it triggers a proper reload.
Tests
New test file: test_llama_cpp_memory_mode.py (19 tests covering memory mode flags, GPU filtering, fit fallback, Vulkan translation, and auto/None equivalence).
I'm confused by what has changed here because the same thing is still happening and I don't see any options to change it. Is it just not in the newest version?
The model totally unloads from VRAM + even some from Ram (depending on how high my system ram usage is) and this means that new requests take a long time to process because literally the model has to be loaded back into VRAM (even partially from disk) which makes no sense.
There should be an option for this where the model is not put into RAM at all and just kept in VRAM unless it is unloaded.
On a discrete card with the model fully offloaded, Keep model in GPU memory emits no launch flag and only vetoes an idle unload, so neither toggle changes residency on your setup.
Closing this, with an honest split on the two asks.
The GPU selection half landed: each model's settings has a GPU picker now, so a load can be pinned to one card or both instead of Studio deciding. That arrived just after the 2026.7.3 you filed from.
The residency half is answered rather than fixed. As above: on a discrete card with the model fully offloaded, "Keep model in GPU memory" emits no launch flag and only vetoes Studio's own idle unload, so neither toggle changes whether the weights stay in VRAM. If a hard "never leave VRAM" control is worth having, that is a feature request rather than this bug and is better filed as one. Nothing needed from you here.
Activity
fix(studio): address GGUF gpu/memory-mode review feedback (unslothai#…
InfoSage05 commentedon Jul 16, 2026
Hi, I've implemented backend support for both GPU selection and memory placement mode on GGUF models. Here's what was done:
Changes
GPU Selection (
gpu_ids)gpu_idsfor GGUF models.gpu_idsare now validated viaresolve_requested_gpu_idsand passed through toLlamaCppBackend.load_model.--fitfallback kicks in.gpu_idsare translated to compact Vulkan ordinals (Vulkan0..N).Memory Placement (
gguf_memory_mode)gguf_memory_modewith three modes:auto(default) — normal memory-mapped loading.pinned— locks pages in RAM via--mlock.resident— loads fully into RAM via--no-mmap --mlock.None,"", and"auto"are canonicalized as equivalent to avoid spurious reloads.--mlock/--no-mmapfromllama_extra_argsare shadowed whengguf_memory_modeis set, so the first-class field always wins._already_in_target_stateand_request_matches_loaded_settingsnow comparememory_mode, so changing it triggers a proper reload.Tests
test_llama_cpp_memory_mode.py(19 tests covering memory mode flags, GPU filtering, fit fallback, Vulkan translation, and auto/None equivalence).test_llama_server_args.py,test_chat_load_during_training.py,test_gpu_selection.py.ruff checkis clean.This should close #7164.
fix(studio): address Codex review feedback on GGUF gpu/memory (unslot…
fix(studio): address Codex round 2 feedback (unslothai#7164)
fix(studio): Vulkan fallback, CPU teardown guard, and frontend round-…
Reviewer fixes: Vulkan-aware CPU guard, /validate diffusion, dedup, a…
fix(studio): let Vulkan reach backend, mirror diffusion in validate, …
fix(studio): explicit auto round-trip, CPU binary guard, same-model p…
jimster480 commentedon Jul 26, 2026
I'm confused by what has changed here because the same thing is still happening and I don't see any options to change it. Is it just not in the newest version?
jimster480 commentedon Jul 30, 2026
The model totally unloads from VRAM + even some from Ram (depending on how high my system ram usage is) and this means that new requests take a long time to process because literally the model has to be loaded back into VRAM (even partially from disk) which makes no sense.
There should be an option for this where the model is not put into RAM at all and just kept in VRAM unless it is unloaded.
danielhanchen commentedon Aug 28, 2026
On a discrete card with the model fully offloaded, Keep model in GPU memory emits no launch flag and only vetoes an idle unload, so neither toggle changes residency on your setup.
LeoBorcherding commentedon Sep 22, 2026
Closing this, with an honest split on the two asks.
The GPU selection half landed: each model's settings has a GPU picker now, so a load can be pinned to one card or both instead of Studio deciding. That arrived just after the 2026.7.3 you filed from.
The residency half is answered rather than fixed. As above: on a discrete card with the model fully offloaded, "Keep model in GPU memory" emits no launch flag and only vetoes Studio's own idle unload, so neither toggle changes whether the weights stay in VRAM. If a hard "never leave VRAM" control is worth having, that is a feature request rather than this bug and is better filed as one. Nothing needed from you here.