Repository navigation
Studio: train on CPU when no GPU is found, and offer Install Training on GPU-less Chat only installs - #16175
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Reached Codex review convergence at oobabooga#439. |
|
With this PR's change to how the chat-only reason is derived ( |
|
One more on this PR: |
|
Correction to the comment above: the route still refuses the embedding model; the test fails only on case. |
|
Two more from
|
|
Fixed in 5247632. All four reproduce locally with
The three Core zoo jobs were cancelled, not failed. |
|
Reached Codex review convergence on 5247632 at oobabooga#439. |
…each the 422 [skip ci]
|
Review record for #16175, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#661. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
Problem
On a host without a GPU, Studio greys out Train with "Training needs an NVIDIA or AMD GPU.", although #14717 added CPU training.
no_gpu. Even past the gate, the training worker'simport unslothrefuses with "Unsloth cannot find any torch accelerator? You need a GPU."no_gpu, notno_torch, so Install Training (Studio: Install Training button in the Train hint and the Export banner #14861) and the Settings upgrade row (Studio: upgrade a Desktop Chat only install to the full install from Settings #14593) are not offered.Cause
Both gates predate CPU training. #14593 reports
no_torchoff Mac only when_a_gpu_build_would_train_here()finds a card, since a full install on a GPU-less host could not train then. #14717 kept Studio out of CPU training by settingUNSLOTH_DISABLE_CPU_FALLBACK=1inmain.pyandrun.py, which the training worker inherits. unsloth-zoo#2162 has since made Studio's training worker run on the CPU backend, and 2026.10.11 ships both.Fix
hardware.py:trains_on_cpu(reason)is true forno_gpuwith PyTorch installed and forno_torchwithout a usable GPU./api/healthreports it ascpu_training.chat_onlystays true, so Chat, Export and Video are unchanged.--no-torchinstall reportsno_torch, so Install Training is offered there too.UNSLOTH_FORCE_CPU=1whentrains_on_cpu()holds, before importing unsloth. Every other Studio process keeps the opt-out./api/train/startrefuses vision and audio datasets, embedding, decision and drafter training on CPU with a 400, since the CPU backend trains text models with SFTTrainer only./studioand its shortcuts follow a newisTrainUnavailable()instead ofisChatOnly(). The Train page notes that training runs on the CPU and, as on MLX, hides the drafter section and leaves a saved or imported drafter out of the request. On a GPU-less Chat only install the upgrade dialog and Settings row promise CPU training only, not export or video.Behavior boundaries
import unslothhas been since Train on CPU when no GPU is found, instead of refusing to import #14717.Verification
Live A/B on Linux with
CUDA_VISIBLE_DEVICES="",trl-internal-testing/tiny-Qwen3ForCausalLMand a 64-row JSONL, through/api/train/startwith Studio defaults:/api/healthchat_only,no_gpuchat_only,no_gpu,cpu_training: trueNew backend tests cover the verdicts, the health field, the start route refusals and the worker environment; they fail on main. Backend files touching these paths: 8,726 passed, with one failure that also fails on main. The full frontend suite has no failures beyond main's. Typecheck, i18n parity and the bundle budget pass, and lint has no new findings.
Not tested: the Desktop Install Training flow end to end on a GPU-less host, Windows or macOS, and models larger than the tiny test model.
Screenshots
main(4d28d72802) and this PR, two isolated installs with every GPU hidden, fresh en-US browser profile.Sidebar with the Train row hovered:
/studioopened directly. Onmainit redirects to Chat:Before / after on a GPU-less host
Two isolated installs (merge base
c510fc1cavs this PR), both launched withCUDA_VISIBLE_DEVICES="",/studioopened directly. Before: the route redirects to Chat and Train is greyed out. After: the Train page stays open with the CPU training notice.