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
{{ message }}
Repository navigation
[Bug] Studio GPU selection ignores 3rd GPU — selects [0,1] with fit: False instead of expanding to all 3 #5680
With 3x ~15.9GB GPUs = ~47GB total VRAM, the model + KV cache (~28GB) should fit across all 3. Studio appears to stop at 2 GPUs even when fit: False and a third GPU is available, rather than expanding the selection.
Expected behaviour: When fit fails across N GPUs and additional GPUs are available, Studio should expand selection to N+1.
I was also expecting equal load across all 3 GPUs this is not the case
Workaround: Trying to pass --tensor-split 1,1,1 via unsloth run extra args forces all 3 GPUs to be used.
Studio's GPU selection logic picks [0, 1] and then launches llama-server with CUDA_VISIBLE_DEVICES=0,1 internally. This means any external override — including CUDA_VISIBLE_DEVICES=0,1,2 in the systemd service Environment= block, /etc/environment, or ~/.bashrc — is ignored because Studio's own selection takes precedence at launch time.
Confirmed by inspecting the llama-server log directly:
0.00.266.430 I - CUDA0 : NVIDIA GeForce RTX 4060 Ti (15947 MiB, 15819 MiB free)
0.00.390.385 I - CUDA1 : NVIDIA GeForce RTX 4060 Ti (15947 MiB, 15819 MiB free)
GPU 2 is completely absent from llama-server's device list.
Things tried that did not work:
Environment="CUDA_VISIBLE_DEVICES=0,1,2" in systemd service file
Passing --tensor-split 1,1,1 --n-gpu-layers 999 as extra args via unsloth run — these are appended after Studio's own flags but llama-server never sees GPU 2 to split across
Hey @lbeischer the idea is to pick the minimul number of GPUs possible for the task so that communication delays are avoided and the performance is faster
Hi, i would like to setup a similar environment. I'm on a server with 2xH100 and used to launch fine-tuning environment via Unsloth docker image. Still DDP is not working. It seems you can train on at least 2 GPUs using Unsloth studio. How did you setup the environment? I tried performing these steps: https://unsloth.ai/docs/basics/multi-gpu-training-with-unsloth/ddp but its not working.
It's not clear where I should start: ubuntu image? nvidia cuda devel image? Some image with torch already installed? Which CUDA version?
I tried installing as per the guide on an image nvidia cuda devel 13.0.2 with python 3.10, but got:
Processing /workspace/unsloth
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
Building wheel for UNKNOWN (pyproject.toml) ... done
Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=17245 sha256=f91133a8c70e69f987ef0b4c8df63e4e6c6561ea5b47b3e7b93e0d092d4dba72
Stored in directory: /tmp/pip-ephem-wheel-cache-8nn_f1ms/wheels/ba/d4/22/1254f43efc75091d68d260956ee9fb01480a2dc07fceeb60a5
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-0.0.0
Hey @lbeischer the idea is to pick the minimul number of GPUs possible for the task so that communication delays are avoided and the performance is faster
Thanks @Datta0 and makes sense as a general principle however in this case studio logged fit: False after selecting [0, 1]:
If the goal is to use the minimum number of GPUs, the selection logic should be:
Try N GPUs
If fit: False, expand to N+1
Repeat until fit succeeds or all GPUs are exhausted
Instead, Studio selects [0, 1], determines fit: False, then proceeds anyway without expanding to GPU 2 — which has 15,945 MiB free and would provide the headroom needed. The result is the model loads across 2 GPUs with insufficient VRAM, causing OOM crashes under load.
If the intended behaviour is truly minimum GPUs, then fit: False should never be an acceptable outcome when additional GPUs are available.
This should be fixed now - sorry on the delay - please update Unsloth Studio to the latest via curl -fsSL https://unsloth.ai/install.sh | sh for Linux, Mac, WSL or irm https://unsloth.ai/install.ps1 | iex for Windows - if it's not fixed yet, it'll be in the next Studio release - if it's still not working after that, please open another issue - appreciate it again!
Fixed in #6718 and #6940, which reserve per-device compute and context so multi-GPU GGUF fit uses all GPUs.
Activity
lbeischer commentedon May 22, 2026
Root cause confirmed:
Studio's GPU selection logic picks [0, 1] and then launches llama-server with CUDA_VISIBLE_DEVICES=0,1 internally. This means any external override — including CUDA_VISIBLE_DEVICES=0,1,2 in the systemd service Environment= block, /etc/environment, or ~/.bashrc — is ignored because Studio's own selection takes precedence at launch time.
Confirmed by inspecting the llama-server log directly:
GPU 2 is completely absent from llama-server's device list.
Things tried that did not work:
Datta0 commentedon May 22, 2026
Hey @lbeischer the idea is to pick the minimul number of GPUs possible for the task so that communication delays are avoided and the performance is faster
lodm94 commentedon May 22, 2026
Hi, i would like to setup a similar environment. I'm on a server with 2xH100 and used to launch fine-tuning environment via Unsloth docker image. Still DDP is not working. It seems you can train on at least 2 GPUs using Unsloth studio. How did you setup the environment? I tried performing these steps: https://unsloth.ai/docs/basics/multi-gpu-training-with-unsloth/ddp but its not working.
It's not clear where I should start: ubuntu image? nvidia cuda devel image? Some image with torch already installed? Which CUDA version?
I tried installing as per the guide on an image nvidia cuda devel 13.0.2 with python 3.10, but got:
lbeischer commentedon May 22, 2026
Thanks @Datta0 and makes sense as a general principle however in this case studio logged
fit: Falseafter selecting[0, 1]:If the goal is to use the minimum number of GPUs, the selection logic should be:
Instead, Studio selects [0, 1], determines fit: False, then proceeds anyway without expanding to GPU 2 — which has 15,945 MiB free and would provide the headroom needed. The result is the model loads across 2 GPUs with insufficient VRAM, causing OOM crashes under load.
If the intended behaviour is truly minimum GPUs, then fit: False should never be an acceptable outcome when additional GPUs are available.
danielhanchen commentedon Jul 14, 2026
This should be fixed now - sorry on the delay - please update Unsloth Studio to the latest via
curl -fsSL https://unsloth.ai/install.sh | shfor Linux, Mac, WSL orirm https://unsloth.ai/install.ps1 | iexfor Windows - if it's not fixed yet, it'll be in the next Studio release - if it's still not working after that, please open another issue - appreciate it again!Fixed in #6718 and #6940, which reserve per-device compute and context so multi-GPU GGUF fit uses all GPUs.