Repository navigation
Description
Environment
Where are you using Unsloth?
- Unsloth desktop application
- Unsloth web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Operating system and version:
Windows 11 Home (10.0.26100), 64-bit
GPU model(s) and accelerator backend:
NVIDIA CUDA, 2 GPUs, CUDA_DEVICE_ORDER=PCI_BUS_ID:
index, name, pci.bus_id
0, Tesla V100-PCIE-32GB, 00000000:04:00.0
1, NVIDIA GeForce RTX 3060 Ti, 00000000:0A:00.0
Versions:
- Unsloth Studio
v0.1.902-beta, package2026.9.14(unsloth_zoo 2026.9.9), which includes PR Widen the pinned child GPU mask when extra args name a companion device (#11810) #11823 (_widen_pin_ids_for_companion_devices). - llama.cpp: official prebuilt
b10797(commit832fd6f17), CUDA 12.4 build, used as a custom binary.
What happened?
Follow-up to #11810 / #11823. The fix works when the load request carries no gpu_ids, but is skipped when it does. In my case the model's saved settings contained gpu_ids: [0, 1], even though I never changed the GPUs toggles (both are on, which is how they appear by default). Studio's fit then pinned llama-server to GPU 0 only, and --mmproj-device CUDA1 failed exactly as in #11810.
Steps to reproduce:
- Select
ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF(IQ3_S, embedded MTP head, with mmproj), click Reset and Forget setting so nothing is saved for it, keep GPU Memory on Default and Remember checked. - In the GPUs list, click GPU 0's ↓ arrow and then its ↑ arrow, so the order is back to GPU 0, GPU 1. Click Save setting. The UI says "setting saved", and
studio.dbnow holds{"gpu_ids": [0, 1]}for this model, although the GPUs section looks exactly as before. - Set extra arguments to
--mmproj-offload --mmproj-device CUDA1and save again. - Load the model. The model fits on GPU 0, so the fit selects
[0](default context 262144 in my run), and the load fails.
Directly: any load whose request carries gpu_ids: [0, 1] while the fit selects [0] should reproduce it (see Root cause).
Expected behavior:
GPU 1 is within the saved gpu_ids, so the mask should widen to [0, 1] the same way it does when no gpu_ids are sent: main model on GPU 0, mmproj on GPU 1.
Actual behavior:
Studio's fit picks one GPU (selected: [0]), the mask is not widened (no Companion device flags ... log line), and both launch attempts (the retry uses --fit on) fail with:
llama-server rejected the value for '--mmproj-device': invalid device: CUDA1. Fix it in the extra arguments for this model.
Without a saved gpu_ids (before step 2, or after clearing it by switching GPU Memory to Manual and back to Default, confirmed in studio.db), the same model with the same extra arguments loads correctly and the mask is widened. From a load just before step 2:
context: 40000, GPUs free: [(0, 32617), (1, 7286)], selected: [0], --fit: off
Companion device flags name GPUs by their unpinned numbering; fitted the pinned mask to them: [0] -> [0, 1]
llama-server ready on port 1725 for model 'ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF'
Model and operation involved:
GGUF inference, llama-server startup. Qwen3.8-27B-GSQ-RCO-IQ3_S-mtp.gguf + mmproj-Qwen3.8-27B-BF16.gguf. Speculative decoding is not involved: at context 262144 Studio replaced the MTP drafter with ngram-mod for the failing load.
Diagnostics and logs
Unsloth web UI
logs/server/server-*.log, failing run with gpu_ids: [0, 1] saved (paths shortened):
GGUF size: 11.3 GB, mmproj: 0.9 GB, est. KV cache: 16.6 GB, context: 262144, GPUs free: [(0, 32617), (1, 7277)], selected: [0], --fit: off
Appending user extra args to llama-server: ['--mmproj-offload', '--mmproj-device', 'CUDA1']
llama-server exited with code 1. Output (tail): ... error while handling argument "--mmproj-device": invalid device: CUDA1 ...
llama-server crashed during startup (exit code 1) with forced --fit off; the fit estimate was optimistic, retrying once with --fit on so it can offload.
llama-server exited with code 1. Output (tail): ... error while handling argument "--mmproj-device": invalid device: CUDA1 ...
Error loading model: llama-server rejected the value for '--mmproj-device': invalid device: CUDA1. Fix it in the extra arguments for this model.
No Companion device flags ... line appears in this run.
Model-specific logs
logs/llama-server/llama-*-try0.log:
error while handling argument "--mmproj-device": invalid device: CUDA1
Additional context
Root cause
The call site passes may_widen = not gpu_ids to _widen_pin_ids_for_companion_devices. When may_widen is False, a companion token is only kept if its physical id is already in main_ids, which is the post-fit pin ([0]), not the requested gpu_ids ([0, 1]):
if not may_widen and physical not in main_ids:
physical = NoneSo when the fit narrows gpu_ids to fewer GPUs, every companion on the GPUs it narrowed away is dropped, even though they are within gpu_ids.
Calling the function directly with Studio's own Python, pin [0], no inherited mask, argv --mmproj-offload --mmproj-device CUDA1:
may_widen=True -> ([0, 1], '[0] -> [0, 1]') # argv gains --device CUDA0
may_widen=False -> ([0], '') # argv unchanged, CUDA1 later rejected
Suggested fix (not validated)
Instead of a boolean, pass the allowed set and widen within it: None (no gpu_ids) widens to any visible GPU as now, and a request with gpu_ids widens only to GPUs in that list. For example, replace may_widen with allowed_ids: Optional[set[int]] (the physical ids of gpu_ids, or None), and change the check to:
if allowed_ids is not None and physical not in main_ids and physical not in allowed_ids:
physical = NoneThat keeps the original intent (never expose a GPU outside gpu_ids) while honoring a companion placed on a GPU inside it.
UI note
Saved gpu_ids: [0, 1] and no saved gpu_ids look identical in the UI: both GPUs toggles are on either way, but only the second lets the mask widen. Nothing in the UI shows that a value is stored, and the toggles can't clear it (the last enabled GPU can't be turned off). The only way I found was switching GPU Memory to Manual and back to Default. The reorder arrows also save gpu_ids even when the order ends up unchanged (step 2), so a single accidental click is enough to hit this bug, with nothing visible in the UI afterwards. In contrast, saving with the toggles untouched keeps the default and writes nothing.
Tested on this single 2-GPU host only.
Activity
Studio: stop rejecting --mmproj-device CUDA1 when gpu_ids are saved (u…
Studio: stop rejecting --mmproj-device CUDA1 when gpu_ids are saved (u…
Studio: stop rejecting --mmproj-device CUDA1 when gpu_ids are saved (u…
Studio: stop rejecting --mmproj-device CUDA1 when gpu_ids are saved (u…