Skip to content

Studio: lock the last enabled GPU switch instead of silently ignoring it - #7259

Merged
danielhanchen merged 1 commit into
unslothai:mainfrom
oobabooga:worktree-gpu-picker-last-switch
Jul 20, 2026
Merged

danielhanchen merged 1 commit into
unslothai:mainfrom
oobabooga:worktree-gpu-picker-last-switch

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Closes #7254

On a multi-GPU host, the GGUF GPU picker in Chat settings lets you uncheck GPUs to narrow which devices llama.cpp uses. toggleGpu keeps at least one GPU selected (if (next.length === 0) return;), but the last-enabled switch was still rendered fully interactive. Clicking it did nothing and gave no feedback, so the switch read as broken.

Fix

Disable the switch of the last-remaining selected GPU so the constraint is visible instead of silent. This mirrors the sibling Tensor Parallelism switch, which already greys out when only one GPU is in use. The next.length === 0 guard stays as the correctness backstop. This change is purely the missing visual affordance.

The single-GPU-in-use predicate shared by both controls is extracted to singleGpuInUse (previously inline in tpDisabled), so the picker and TP gate can't drift apart.

The InfoHint gains one sentence: "At least one GPU must stay selected."

Behavior boundaries

  • All GPUs checked (default): every switch stays enabled, so any one can be unchecked.
  • Narrowed to one GPU: only that GPU's switch locks on. The unchecked ones stay enabled, so you can re-add a device or swap which one is active.
  • CPU-only offload is unchanged and remains its own control (GPU Memory = Manual, GPU Layers = 0). The picker never claimed to do it.

Verification

tsc -b and eslint on the changed file pass with no new findings. The file's pre-existing lint warnings are untouched.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request ensures that at least one GPU remains selected in the chat settings panel. It introduces a singleGpuInUse check to disable the checkbox for the last selected GPU, preventing the user from unchecking all GPUs, and updates the corresponding UI hints and comments. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 94c68aef1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@danielhanchen
danielhanchen merged commit 7313be1 into unslothai:main Jul 20, 2026
9 of 36 checks passed
VectorCipher pushed a commit to VectorCipher/unsloth that referenced this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can't disable GPU when loading models

2 participants