Skip to content

Desktop: offer a chat-only (GGUF) install and keep it through repairs - #14245

Merged
danielhanchen merged 13 commits into
mainfrom
studio-desktop-chat-only-install
Oct 20, 2026
Merged

danielhanchen merged 13 commits into
mainfrom
studio-desktop-chat-only-install

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Fixes #9954

Summary

Users who only want local chat or an OpenAI compatible server for agents currently get the full training and image stack on first launch of Unsloth Desktop. On the reporter's Windows AMD machine that is 6.4 GB of Python packages, about 5.2 GB of which is PyTorch plus the ROCm SDK wheels. The installers already support a GGUF-only mode (--no-torch / UNSLOTH_NO_TORCH=1), but Desktop had no way to ask for it.

This PR:

  1. Adds an unchecked "Chat only (GGUF): smaller install, no training" checkbox under Get Started on the Desktop first-run screen. Leaving it unchecked keeps today's flow and today's full install. Checking it runs the same installer with UNSLOTH_NO_TORCH=1.

  2. Keeps a chat-only install chat-only through the startup auto-repair. install.sh / install.ps1 read the mode from the environment only, so before this change the auto-repair's installer fallback would silently pull the whole PyTorch stack into a GGUF-only install (Desktop or CLI). The Desktop now reads the mode the venv recorded (the manifest's no_torch key, then the .unsloth-no-torch marker, the same order as install_manifest.recorded_no_torch) and passes it back. The installer always gets UNSLOTH_NO_TORCH set to 1 or 0, so a value inherited by the app cannot override the user's choice.

  3. Settings > Repair installation is unchanged: it still reinstalls PyTorch, as its confirm dialog says. That is now the documented way to add training to a chat-only Desktop install, and the greyed Train hint on Desktop points there instead of at a CLI flag.

  4. Reports a GGUF-only install as no_torch on Windows and Linux too. Before, only Apple Silicon got that verdict, so a chat-only install on a GPU machine was told "Training needs an NVIDIA or AMD GPU".

  5. Raises the startup bundle budget by this PR's growth: 679 B raw / 205 B transfer (6,842,169 -> 6,842,848 B raw, 2,060,319 -> 2,060,524 B transfer against main 26e246d407, one machine and build, Node 24). The checkbox is in the eager startup screen and the hint in the eager sidebar, so there is no lazy home for it. Re-measured after merging main at d6a7ae8bd: 6,844,141 B raw / 2,060,932 B transfer against the new limits of 6,844,328 / 2,060,999.

Behaviour

Path Before After
Desktop first run, Get Started (default) Full install Full install (unchanged)
Desktop first run, Chat only checked Not possible GGUF-only install, chat/API work, Train disabled
Linux elevation resume after system packages Full install Same choice the user made
Startup auto-repair, installer fallback, on a GGUF-only venv Installs PyTorch (several GB) Stays GGUF-only
Settings > Repair installation Installs PyTorch Installs PyTorch (unchanged)
unsloth studio update Keeps the recorded mode Unchanged
Train hint on a GGUF-only Windows / Linux install "Training needs an NVIDIA or AMD GPU." Desktop: "Use Repair installation in Settings to add it." Web: "Reinstall without --no-torch to enable Train."
Train hint on a GGUF-only Apple Silicon Desktop install "Reinstall without --no-torch" "Use Repair installation in Settings to add it"

The CLI installers are untouched. The only web Studio change is the Train hint text on a GGUF-only Windows / Linux install.

Testing

  • cargo test install::tests (46 passed), including two new tests: the chat-only env reaches the installer (and 0 otherwise), and the recorded mode is read from the manifest, then the marker, and is false for missing / malformed state.
  • studio/backend/tests/test_chat_only_reason.py (15 passed): a recorded GGUF-only Windows install reports no_torch, a torch install without an accelerator still reports no_gpu. The first fails on main.
  • npm test in studio/frontend (12793 passed). The new test checks chatOnly reaches start_install and survives the option-less elevation resume. It fails on main.
  • install.sh --tauri --local with UNSLOTH_NO_TORCH=1 in a fresh home: exit 0, .unsloth-no-torch and "no_torch": true recorded, and unsloth studio desktop-capabilities --json reports studio_install_ok: true and llama_runtime_ok: true, so the Desktop preflight treats the result as ready rather than looping into repair.
  • Measured on Linux: a GGUF-only Studio folder is 1.4 GB in total (Python environment 1.2 GB) with no torch, ROCm, CUDA, bitsandbytes or xformers packages.

Screenshots

Desktop first-run screen, rendered from the built frontend bundle of the merge base and of this branch. Left: main. Middle: this PR with the default left alone (the same full install as before). Right: Chat only checked, which sends chatOnly: true to start_install.

Desktop first-run screen before and after

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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 ⚠️ Failed 2026-10-20T11:57:39.909443Z cec6c37 New commits
🔒 Security Review ✅ Completed 2026-10-19T12:25:12.815238Z 5238fa3 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.

@danielhanchen danielhanchen self-assigned this Oct 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5238fa35cd

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 85cb820662

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

pre-commit.ci run

danielhanchen added a commit that referenced this pull request Oct 19, 2026
…14272)

## Summary

`Frontend build + bundle sanity` fails its `Typecheck` step (`npm run
typecheck`, tests included) on PRs based on current main (seen on
#14245):

```
tests/image-engine-choice.test.ts(305,48): error TS2339: Property 'baseRepo' does not exist on type '{ repoId: string; kind?: ...; filename?: ...; } | { repoId: string; kind: "gguf"; filename: string; displayRepoId?: string; baseRepo?: string; }'.
tests/image-mask-from-text.test.ts(246,30): error TS2345: Argument of type '"drawImage"' is not assignable to parameter of type 'never'.
tests/image-mask-from-text.test.ts(246,61): error TS2345: Argument of type '"putImageData"' is not assignable to parameter of type 'never'.
```

Reproduced on main `6c159816c5` with `node scripts/typecheck.mjs
--tests` (TypeScript 7.0.2, as CI). The product code typechecks. Both
errors are in tests:

- **`image-engine-choice.test.ts` (from #14232):**
`nativeReloadTarget(null, gguf)?.baseRepo`. With `null` as the last
load, `T` falls back to its constraint, which has no `baseRepo`, so one
branch of the return union lacks the property.
- **`image-mask-from-text.test.ts` (from #14235):**
`assert.deepEqual(calls, [])` from `node:assert/strict` is an assertion
signature. It narrows `calls` to `never[]`, so the later
`calls.includes("drawImage")` no longer typechecks.

## Change

Test-only:

- **`image-engine-choice.test.ts`:** `nativeReloadTarget<{ repoId:
string; baseRepo?: string }>(null, gguf)?.baseRepo`. This names `T`, so
the status-built branch, the one that carries `baseRepo`, is what is
read. The assertion is unchanged.
- **`image-mask-from-text.test.ts`:** `assert.equal(calls.length, 0)` in
place of `assert.deepEqual(calls, [])`. It asserts the same thing
without the narrowing, with a comment saying why.

## Testing

- **`node scripts/typecheck.mjs --tests`:** clean (exit 0), from the
three errors above on main.
- **`node --experimental-strip-types --test` on both files:** 30 passed.
…nly-install

# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
danielhanchen added a commit that referenced this pull request Oct 19, 2026
#14271)

## Summary

Two tests in `studio/backend/tests/test_diffusion_segment.py` fail in
the `(Python 3.13, a-k)` shard on PRs with different bases (#14229,
#14245):

```
test_choose_device_needs_room_on_the_card
test_choose_device_reads_bf16_on_the_chosen_card
E   AssertionError: assert ('cpu', torch.float32) == ('cuda:1', torch.bfloat16)
```

Both pass when the file runs on its own (64 passed).

## Cause

`choose_device()` (from #14235, SAM 3 masks) puts SAM 3 on the CPU when
another GPU arbiter owner holds the card (`_other_owner_on` ->
`gpu_arbiter.residents()`). The arbiter's `_owner` / `_residents` are
module globals. These two tests stub torch and the free-memory probe but
not the arbiter. So when an earlier test in the same xdist worker leaves
a CHAT owner behind, they see the card as taken and pick the CPU. The
product is right to refuse a card another owner holds. The tests were
order dependent.

## Change

Test-only: an autouse fixture in `test_diffusion_segment.py` clears
`gpu_arbiter._owner` and `_residents` before each test (with
`monkeypatch`, so they are restored). Tests that exercise ownership
already set their own owner, and still do.

## Testing

- **`test_diffusion_segment.py`:** 64 passed.
- **Sabotage:** I added a throwaway test that sets `gpu_arbiter._owner =
gpu_arbiter.CHAT` and ran it first in the same process:
- **Without the fixture:** `test_choose_device_needs_room_on_the_card`
and `test_choose_device_reads_bf16_on_the_chosen_card` fail. These are
the two CI failures.
  - **With it:** all pass.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…nly-install

# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
@danielhanchen
danielhanchen merged commit 3ceb606 into main Oct 20, 2026
@danielhanchen
danielhanchen deleted the studio-desktop-chat-only-install branch October 20, 2026 12:44
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 21, 2026
…xport page (unslothai#14438)

On a Desktop install where the user ticked "Chat only (GGUF)", the
Export page says:

> This install was set up without the training stack (--no-torch), so
export is disabled. Reinstall Unsloth Studio without --no-torch to
enable export.

The user never typed `--no-torch`, and the app has no way to reinstall
without it. The fix that works from inside the app is Settings > Repair
installation, which the Train tooltip in the sidebar already recommends.

## Cause

unslothai#14245 made a Windows or Linux Chat only install report `no_torch`
instead of `no_gpu`. That sends Desktop users to the backend's
`no_torch` export message, which was written for CLI `install.sh
--no-torch` users. `ExportPage` shows it unchanged in the banner and in
the tooltip on the greyed method cards. The same PR gave the Train hint
a Desktop variant, but Export did not get one.

## Fix

`exportUnsupportedText()` in
`studio/frontend/src/features/export/lib/unsupported-text.ts` (lazy
Export chunk, not the startup bundle) decides the page's text. When the
reason is `no_torch` and a Repair action is available (the Train hint's
`canRepair` check), it returns "Export was left out of this install
(Chat only). Use Repair installation in Settings to add it." Otherwise
it returns the backend message as before. Web users, CLI users and a
Desktop attached to a terminal-started backend have no Repair action, so
they keep the `--no-torch` advice. After a successful Repair, the
Desktop also drops the cached hardware verdict, so Export re-reads the
new backend instead of staying disabled. There are no backend, API or
locale changes.

## Verification

- `tests/export-unsupported-text.test.ts` covers `no_torch` with and
without Repair available, other reasons, no backend message, and that a
successful repair invalidates the cached hardware verdict before the
backend restarts. The full frontend suite, typecheck and lint show no
new failures.
- A/B in the Desktop app on Windows 11 (AMD Radeon 8060S), using one
Chat only install opened with debug builds of the base commit (BEFORE)
and the base plus this change (AFTER).

<img width="1472" height="705" alt="pair_00_export_banner"
src="https://github.com/user-attachments/assets/01d97a7b-3915-4e7a-9487-aa8510c1ba79"
/>

<img width="1480" height="483" alt="pair_01_card_tooltip"
src="https://github.com/user-attachments/assets/5e44be83-b1a7-4243-a63d-d09bdc8b3518"
/>



Following the new text, Settings > Repair installation installed torch
2.11.0+rocm7.14.0:

<img width="1492" height="523" alt="after_repair_export"
src="https://github.com/user-attachments/assets/3fca14df-aa6b-4066-b5f9-83d457968498"
/>


The web UI and an external-server Desktop were not tested live. Only the
unit test covers them.



## Web parity check

Web Studio built from the merge base (BEFORE) and from this branch
(AFTER), Chromium, with `/api/system/hardware` returning the backend's
`no_torch` export verdict on both sides. The web build has no Repair
action, so both keep the `--no-torch` advice and neither shows the
Repair installation text.

![Export page, BEFORE vs AFTER, web Studio with a no_torch
verdict](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14438/pr14438_before_after-f48c1d9ddb67.png)

---------

Co-authored-by: Daniel Han <[email protected]>
danielhanchen added a commit that referenced this pull request Oct 22, 2026
…Settings (#14593)

Desktop users who chose Chat only (GGUF) (#14245) currently have to use
Repair installation to upgrade. That action is buried under Danger zone,
its wording assumes PyTorch is already installed, and Settings searches
for "train", "pytorch" or "chat only" find nothing. After the upgrade,
Train can remain disabled until the app restarts.

This PR adds **Upgrade to full install** to Settings, updates the Train
and Export hints to point there, and refreshes hardware detection after
the upgrade so Train can become available without another app restart.
On an eligible install, clicking the greyed Train row also opens the
same upgrade dialog.

## What changes

- Settings > General gains an Install type row below the version and
update controls. Eligible Chat only installations get an Upgrade to full
install button. Settings search finds the row through terms such as
"train", "pytorch" and "chat only", and excludes it when the row is
hidden.
- The confirmation dialog explains what the full install adds: training,
export, video, safetensors models and additional image generation
features. It warns about the download of several gigabytes and the
server restart, and confirms that chats, models and settings are kept.
- Train and Export hints direct eligible users to the new Settings
action. Train stays disabled until training is available.
- On an eligible Desktop Chat only install, the greyed Train row is
clickable: it stays greyed out, its tooltip reads "Training is not
installed. Click to install it (at least 5 GB of disk space).", and
clicking it opens the same Upgrade to the full install dialog as
Settings. It never navigates to or preloads Train until training is
available. Hosts that cannot be upgraded keep today's disabled row and
hint.
- The confirmation dialog states the disk space the full install needs:
at least 5 GB. Measured on Linux with an NVIDIA GPU, the environment
grows from 1.16 GB to 7.02 GB.
- Repair and progress messages explain that a Chat only installation is
being upgraded and that this can take several minutes. Upgrade failures
also get a specific message. The new Settings strings are translated in
every locale.

## Who gets the upgrade option

The option appears once hardware detection identifies a Chat only
installation as `no_torch`, provided Desktop manages the backend and the
backend reports no blocking hint.

- **Windows and Linux:** GPU detection runs without PyTorch. It uses the
existing filter for identifying GPUs that an incompatible PyTorch build
cannot use: NVIDIA, ROCm-supported AMD, Intel Arc and Intel Data Center
GPUs. An inconclusive detection result also allows the offer. CPU-only
machines and machines with only unsupported integrated GPUs report
`no_gpu` and keep the existing hardware requirement hint.
- **Apple Silicon:** The offer is withheld when the installer would skip
MLX because the machine does not meet its requirements: macOS 14 or
later and Python 3.10 or later. Train and Export explain the missing
requirement. An unreadable macOS version is treated as unsupported,
matching the installer.
- Other reasons for Chat only mode keep their existing hints and receive
no upgrade offer.

Web and CLI installations, and Desktop connected to a backend started in
a terminal, receive no upgrade action. Their existing `--no-torch`
advice remains, except where the Mac requirement message applies.
Automatic startup repair continues to preserve Chat only mode.

## Implementation

The button calls the existing `repairInstall()`, which reruns the
installer with `UNSLOTH_NO_TORCH=0`.

The disabled Train issue came from retaining the previous backend's
hardware result while the replacement backend was still detecting
hardware. The frontend now marks that result stale after a backend
replacement. Train shows its checking spinner, and polling continues
until a new result arrives. If detection is deferred, the old reason is
cleared so the completed upgrade is not offered again.

The startup bundle budget increases by the measured growth, mostly from
the new English Settings strings.

## Known limits

GPU eligibility does not reproduce the installer's full selection of
PyTorch packages. Some machines can still receive the offer but end up
with CPU PyTorch and disabled training: Van Gogh (gfx1033), Jetson
before CUDA 13, NVIDIA drivers older than CUDA 11, or installations
pinned to a CPU package index. The existing Train tooltip already
directs these machines to Repair installation.

GPU changes made while the app is running are detected on the next
start.

## Verification

Windows 11 Desktop was compared on a Ryzen AI MAX+ 395 with Radeon 8060S
using two debug builds: main at the merge base (`0391814917`, frontend
and backend), and that base plus this PR. Each used a fresh profile, a
fresh Chat only install and an en-US WebView.

Both upgraded successfully and returned `chat_only: false`. On main,
Train was still disabled after 60 seconds. With this PR, it showed the
checking spinner and became enabled after 2 seconds.

- Backend: 511 hardware, verdict, health, export and CPU-build tests
pass, including the PyTorch-free sandbox suite. Regression coverage
checks GPU, CPU-only, Intel UHD and inconclusive detection results. The
CPU-only and Intel UHD cases fail when the new check is bypassed.
- Frontend: Coverage includes upgrade eligibility, Settings search,
dialog text, the Train hint and hardware state after backend
replacement. Typecheck, `i18n:check:strict`, build and `bundle:check`
pass. The full suite has 12 failures that also occur on main.

Not tested live: CPU-only or iGPU-only machines, macOS Desktop or Linux
Desktop.

Linux with an NVIDIA GPU, end to end through the installer the upgrade
runs:

| Step | Chat only install | After the upgrade (`UNSLOTH_NO_TORCH=0
UNSLOTH_TORCH_UPGRADE=1`) |

|------|-------------------|------------------------------------------------------------------|
| PyTorch | not installed | `2.13.0+cu130`, CUDA available |
| `/api/health` | `chat_only: true`, `no_torch`, no hint | `chat_only:
false` |
| Install mode record | manifest `no_torch: true`, marker present |
manifest `no_torch: false`, marker removed |
| Environment size | 1.16 GB | 7.02 GB |
| User data outside the environment | 7,707 files | 0 changed, database
row counts identical, same password still signs in |

Train row, both builds against the same backend with a Chat only verdict
on a GPU host (`no_torch`, no hint), in the Desktop shell: on main the
row is disabled and a click does nothing; with this PR the row is
enabled but greyed, a click opens the dialog, Cancel starts nothing, and
Upgrade starts the managed repair. Same result on 3 of 3 runs.

## Screenshots

BEFORE is main at the merge base, AFTER is this PR.

**Train hint**

<img width="1304" height="384" alt="1-train-hint"
src="https://github.com/user-attachments/assets/b80e95e6-5610-4f13-8f87-f5f2a12ab808"
/>


**Settings > General**

<img width="1448" height="547" alt="2-settings-general"
src="https://github.com/user-attachments/assets/675b775e-3045-4f59-8484-6e156b2e14c8"
/>



**Settings search for "pytorch"**

<img width="1064" height="327" alt="3-settings-search"
src="https://github.com/user-attachments/assets/99e69175-deb9-463a-a3c3-ff5ea1f95e81"
/>



**Repair installation on a Chat only install**

<img width="1016" height="352" alt="4-repair-confirm"
src="https://github.com/user-attachments/assets/8e38b67f-ad4f-49e7-a8fb-84c14f4bfce8"
/>



**Progress screen during the upgrade**


<img width="1464" height="244" alt="5-progress"
src="https://github.com/user-attachments/assets/1e8761e2-4b13-434a-b4d2-eb7febd2b4c8"
/>


**Train once the app is back**

<img width="1304" height="384" alt="6-after-upgrade"
src="https://github.com/user-attachments/assets/3814e4bf-93cb-49dc-a28b-2258a12454a1"
/>



**Export page hint**

<img width="1060" height="322" alt="7-export"
src="https://github.com/user-attachments/assets/9523a092-843e-4302-860f-f8613bfcd952"
/>


**Train row on a Chat only install**

![Train row tooltip before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14593/pair_1_train_hover-89df60c2c240.png)

**Clicking the greyed Train row**

![Clicking Train before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14593/pair_2_train_click-f1430a6d6ac8.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Selective Installation to reduce installation size (currently 8.2 GB, python taking 6.4 GB)

1 participant