Skip to content

Studio: Install Training button in the Train hint and the Export banner - #14861

Merged
danielhanchen merged 3 commits into
mainfrom
studio-install-training-banner-button
Oct 23, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-install-training-banner-button

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

On a Desktop Chat only install whose hardware can train, the greyed Train row's hover hint and the Export unavailable banner only described the problem. The way to fix it was a click on the row itself (#14593) or a trip to Settings. This PR puts a small Install Training button in both places, opening the same Upgrade to the full install dialog.

What changes

  • Train row hint: on an upgradable install it now reads "Training is not installed. It needs at least 5 GB of disk space." with an Install Training button under it. The row itself still opens the dialog on click, as before.
  • Export page: the red Export unavailable banner gets the same button under its message.
  • Both buttons open the existing confirm dialog; nothing installs until Upgrade is pressed there.
  • Shown only where Studio: upgrade a Desktop Chat only install to the full install from Settings #14593 already offers the upgrade: a measured no_torch verdict, no blocking hint, and a Desktop that manages its backend. Web and CLI installs, hosts without a trainable GPU, Macs the MLX wheels skip and AMD hosts behind closed device nodes see exactly what they see today.

Implementation

  • NavRowDef gains an optional tooltipAction, which NavItem renders as a button under the tooltip text. A row still checking its capability (spinner) never shows it.
  • The sidebar's TooltipProvider sets disableHoverableContent, so the pointer could never reach a button inside a nav tooltip: it closed as soon as the pointer left the row. SidebarMenuButton gets an interactiveTooltip prop that opts that one tooltip back into hoverable content; every other sidebar tooltip is unchanged.
  • The startup bundle budget rises by the measured growth: +424 B raw / +141 B transfer.

Verification

Both frontend builds were loaded in Chromium against the same real backend: a --no-torch install of this branch on a Linux host with NVIDIA GPUs, which reports chat_only: true, no_torch, no hint. A minimal stand-in for the Desktop shell's native commands was used, since the effect only exists inside Desktop and this host has no WebKit driver.

main (ee55c3c9a) this PR
Train row hint text only text plus Install Training button
Pointer moved from the row onto the button n/a tooltip stays open, button clickable
Button click n/a opens Upgrade to the full install
Export unavailable banner text only text plus Install Training button
Banner button, then Upgrade n/a dialog opens, managed repair starts

Same result on 3 of 3 runs.

  • Frontend: 13,688 tests, 0 failures. Typecheck, i18n:check:strict, build and bundle:check pass.
  • A new test pins both buttons and the hoverable opt-in; it fails on main.

Not tested: a real macOS or Windows Desktop window, and keyboard-only access to the tooltip button (the row itself stays keyboard reachable and opens the same dialog).

Screenshots

BEFORE is main at ee55c3c9a, AFTER is this PR, both against the same Chat only backend.

Train row hint

Train row hint before and after

Export unavailable banner

Export banner before and after

…rt banner

On an upgradable Desktop Chat only install, the greyed Train row's hover hint
and the Export unavailable banner now carry a small Install Training button
that opens the existing Upgrade to the full install dialog. The sidebar
tooltip provider disables hoverable content, so a tooltip holding a control
opts back in.
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 23, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 23, 2026
@danielhanchen danielhanchen self-assigned this Oct 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T02:41:31.745818Z d81ffaf Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a97c03295

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

}
disabled={rowState.disabled}
tooltip={rowState.tooltip}
tooltipAction={rowState.pending ? undefined : row.tooltipAction}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Forward the install action to overflow Train rows

When a user unpins Train in Settings > Appearance, the row is rendered through overflowNavIds as a MoreMenuItem, but this new action is forwarded only to the inline NavItem. The overflow row therefore retains only a native text tooltip—now without the previous “Click to install” guidance—and never displays the promised Install Training button. Pass the action through the overflow rendering path as well, or otherwise preserve an explicit install affordance there.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d81ffaf: an unpinned Train item in the More menu keeps the click guidance in its title, and selecting it already opens the same dialog.

Comment on lines +688 to +690
<Button size="xs" onClick={tooltipAction.onClick}>
{tooltipAction.label}
</Button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Move the install control into a focusable popup

When a keyboard user focuses the Train row and presses Tab toward this button, Radix Tooltip closes on the trigger's blur and unmounts its content before focus can reach the button. Setting disableHoverableContent to false only preserves the tooltip during pointer movement, so the newly advertised control remains mouse-only even though it is rendered as a focusable Button; use a popover/menu with managed focus or keep the action outside the tooltip.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this: the Train row itself is a focusable, enabled button, and Enter on it opens the same Install Training dialog, so keyboard users already have the action. The tooltip button is a pointer shortcut on top of that.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: d81ffafb2b

ℹ️ 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 d368a7b into main Oct 23, 2026
4 of 38 checks passed
@danielhanchen
danielhanchen deleted the studio-install-training-banner-button branch October 23, 2026 03:22
danielhanchen added a commit to Etherll/unsloth that referenced this pull request Nov 1, 2026
… on GPU-less Chat only installs (unslothai#16175)

## Problem

On a host without a GPU, Studio greys out Train with "Training needs an
NVIDIA or AMD GPU.", although unslothai#14717 added CPU training.

- **Full install** (the default; the installers put CPU PyTorch on such
a host): the verdict is `no_gpu`. Even past the gate, the training
worker's `import unsloth` refuses with "Unsloth cannot find any torch
accelerator? You need a GPU."
- **Desktop Chat only install:** the verdict is also `no_gpu`, not
`no_torch`, so Install Training (unslothai#14861) and the Settings upgrade row
(unslothai#14593) are not offered.

## Cause

Both gates predate CPU training. unslothai#14593 reports `no_torch` off 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. unslothai#14717 kept Studio out
of CPU training by setting `UNSLOTH_DISABLE_CPU_FALLBACK=1` in `main.py`
and `run.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 for `no_gpu` with
PyTorch installed and for `no_torch` without a usable GPU. `/api/health`
reports it as `cpu_training`. `chat_only` stays true, so Chat, Export
and Video are unchanged.
- Every off-Mac `--no-torch` install reports `no_torch`, so Install
Training is offered there too.
- The training worker sets `UNSLOTH_FORCE_CPU=1` when `trains_on_cpu()`
holds, before importing unsloth. Every other Studio process keeps the
opt-out.
- `/api/train/start` refuses vision and audio datasets, embedding,
decision and drafter training on CPU with a 400, since the CPU backend
trains text models with SFTTrainer only.
- Frontend: Train, `/studio` and its shortcuts follow a new
`isTrainUnavailable()` instead of `isChatOnly()`. 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

- A host whose GPU this PyTorch cannot use keeps its repair message
instead of falling back to CPU.
- CPU training is on by default, as `import unsloth` has been since
unslothai#14717.
- A vision model with a text dataset is not refused up front; the CPU
backend's own error surfaces at model load.

## Verification

Live A/B on Linux with `CUDA_VISIBLE_DEVICES=""`,
`trl-internal-testing/tiny-Qwen3ForCausalLM` and a 64-row JSONL, through
`/api/train/start` with Studio defaults:

| | main | this PR |
|---|---|---|
| `/api/health` | `chat_only`, `no_gpu` | `chat_only`, `no_gpu`,
`cpu_training: true` |
| LoRA, 6 steps | "Unsloth cannot find any torch accelerator? You need a
GPU." | completes, adapter saved |
| Full finetuning, 4 steps | not run | completes |
| Image dataset | not run | 400 |

New 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:

<img width="2424" height="846" alt="cpu_training_train_row"
src="https://github.com/user-attachments/assets/5a954770-3bc7-4c83-ba28-fe0d1df87509"
/>


`/studio` opened directly. On `main` it redirects to Chat:

<img width="4424" height="936" alt="cpu_training_train_page"
src="https://github.com/user-attachments/assets/9bf247f3-76b5-4e8c-bcb7-a877086ae330"
/>



### Before / after on a GPU-less host

Two isolated installs (merge base `c510fc1ca` vs this PR), both launched
with `CUDA_VISIBLE_DEVICES=""`, `/studio` opened directly. Before: the
route redirects to Chat and Train is greyed out. After: the Train page
stays open with the CPU training notice.

![Train page before and after on a GPU-less
host](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16175/pr16175_before_after-8bc8ca2591ef.png)

---------

Co-authored-by: Daniel Han <[email protected]>
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.

1 participant