Skip to content

Unsloth Studio / Desktop: pick, download and load models on a linked instance from the chat and Images pickers - #12093

Draft
LeoBorcherding wants to merge 59 commits into
unslothai:mainfrom
LeoBorcherding:feat/studio-linked-model-picker
Draft

LeoBorcherding wants to merge 59 commits into
unslothai:mainfrom
LeoBorcherding:feat/studio-linked-model-picker

Conversation

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

Builds on #12092 (linked instances); review that one first. The diff includes its commits until it merges.

A half-pill beside Recommended / On Device picks which machine the chat and Images pickers browse. Choose a linked instance and its catalogue, downloads and loads all happen there; this machine's disk and GPU are untouched.

What it adds

  • Machine switch: lists this machine and every linked instance with its GPUs, pooled VRAM and how it's reached. It's in the chat and Images pickers only, not Train or the Model Hub.
  • Recommended / On Device for a linked machine:
    • Rows are laid out like local ones: format dot, parameter count, size, quant expansion with downloaded tags.
    • Fit badges use the remote's pooled VRAM.
    • Chat's On Device leaves out image, video and audio models.
  • Chat: picking a quant downloads it on the remote if needed and loads it there, behind a progress toast. The chat then runs through /v1 as @name/model.
  • Images: load, generate, gallery and progress run on the linked instance. The trigger names the machine: "Qwen-Image-2.1-GGUF @colab · GGUF".
  • Backend: /api/linked-instances/{id}/proxy/{path} relays an allowlisted set of calls (model lists, hub downloads, inference load/unload/status, image routes) with the instance's key. Settings, keys, accounts and training are not on the list. Gallery URLs in responses are rewritten to come back through the proxy.

Screenshots

Chat picker, before (main) and after:

before
after

Image picker, before and after (browsing @colab):

before
after

Machine switch from chat and from Images (the 4, 8 and 16 GPU entries are fake local servers, there to check the layout):

chat switch
images switch

Recommended and On Device on @rx6500:

recommended
on device

A download on @wsl:

download

Chat served by @rx6500:

chat

Qwen-Image generated on @colab:

image

Where it was run

Measured at 810655de03.

Path Machine Result
Chat: pick, load, stream @rx6500 (RX 6500 XT + RX 5700 XT, LAN) Qwen3-1.7B loaded there, 34.3 tok/s through the desktop
Chat: download then load @wsl (R9700, WSL2) Qwen3.5-0.8B Q4_K_M downloaded on the remote with a progress toast, then loaded
Images: load, generate, gallery @colab (L4, Cloudflare tunnel) Z-Image-Turbo Q8_0 and Qwen-Image-2.1 Q4_K_M generated; gallery served through the proxy

Not run:

  • An image model that has to download on the remote (both image models were already there).
  • The Video and Audio pages: they don't get the switch in this PR.

Known gaps

  • A linked chat pick isn't restored after an app restart.
  • In linked mode the Images gallery shows the remote's gallery, not this machine's.

Tests

  • test_linked_instances.py on this branch: 40 pass, including the proxy allowlist, key injection, URL rewrite, query and binary streaming.
  • Frontend typecheck is clean.

…mote's own API; API page panel and details dialog
…w and grows on scroll, detail pane follows the newest request, no truncated labels
The rail, the settings row and the details dialog read only the first GPU, so a machine with an RX 6500 XT and an RX 5700 XT showed as one 4 GB card (and the settings row as 2x RX 6500 XT). They now name each card, sum the VRAM, and the dialog adds a Total VRAM line.
The rail groups cards by model and draws one VRAM cell per card in rows of up to 8. The details dialog puts Total VRAM first and scrolls the per-card list past two cards, numbering each card and wrapping long names instead of cutting them off.
…d images

A half pill beside On Device switches the chat and Images pickers to a linked Unsloth Studio. Recommended and On Device then list that machine's models; a pick downloads and loads there through an allowlisted proxy that adds the instance's key server-side. /v1/images/generations forwards @name/model ids, and the Images page loads and generates on the machine its model came from.
A probe that timed out marked a reachable machine offline and the panel refused to list it. The panel now tries the machine's inventory and reports only a real failure. Fit, the header and the machine menu use every card's VRAM, since llama.cpp splits a GGUF across them.
…detectCapabilities

The Images trigger names the linked machine with the cloud icon, as chat does for @-ids.
The media filter used detectCapabilities without importing it.
…s on the tab row

Linked quant rows use the local variant markup: mono label, downloaded tag, fit badge and size.
The panel widens by the machine switch so All and Recent no longer wrap.
@danielhanchen danielhanchen added >3000# affects UI# security# Moves a security boundary: sandbox, allowlist, permission or network guard labels Sep 27, 2026
pre-commit-ci Bot and others added 3 commits September 27, 2026 07:32
…instances

# Conflicts:
#	studio/frontend/src/features/api-monitor/api-monitor-page.tsx
…odel-picker

# Conflicts:
#	studio/frontend/src/features/chat/api/chat-adapter.ts
Main's contrast-slider scan covers the rail: its bar tracks now use the contrast-wash gain.
…d UI scale checks

Read the media catalogs inside a function, since they come through the chat barrel and a module-scope read throws when the import cycle re-enters. Keep the picker's resolved memo named currentModel and call the linked-machine wrapper triggerModel, so the dropped-model label check finds the memo that consults the connections. The gallery delete test stubs ip(), which every image route goes through for the linked machine. The machine name's max width scales with --ui-space-scale.
/v1/models lists every linked instance's models as @name/id, embedding
models included, but /v1/embeddings had no linked branch, so a client that
picked one got the local embedding path or an error instead of the instance
that serves it. It now resolves and forwards like completions does. Test
added.
…CI contracts

The Hebrew and Swedish overlays arrived with the merge of main and had none
of the 61 linked-instance strings, which fails the strict i18n check. The
linked-instance routes are owner-only installation objects, so the account
isolation matrix skips them with that reason, as it does for NPU models. The
usage-examples contract reads the filtered catalog set, the API page's
overflow contract leaves the font-mono example request alone, and a blank
line from the merge resolution is formatted away.
The proxy is behind the same installation-owner check as the other
linked-instance routes, so it carries the same skip reason.
Image, speech and separation models carry a task, and none of their
endpoints forwards a linked id, so advertising them sent a client that
picked one to the local media runtime. They are left out until their
endpoint forwards. Test added.
Image generation resolves and forwards a linked id here, so text-to-image
rows stay in the linked catalog; speech and separation rows stay out.
The catalog filter ran after probe, so the status cards in Settings still
listed media models as copyable ids. The filter now runs in probe, which
both read. Test added.
…witch

Picking a model on another machine moved progress polling, Stop and the
gallery before the busy check, so Stop could go to the wrong machine. The
switch is now refused while work is running. An idle switch kept the old
machine's shelf, whose actions then went to the new machine; it is now
dropped, any listing in flight is fenced, and the new shelf is fetched.
Test added.
…gone

A removed linked instance left its id stored, so every Images request went
to its proxy and returned 404. Once the refreshed list lacks it, the page
switches to this machine through the same path a pick takes; the list is
force-refreshed on open so a removal in Settings is seen. Test added.
Chat completions ran the local tool admission before resolving a linked
model, so on a managed install a full-access request to a linked model was
refused here although the linked server applies its own policy. It now
resolves first, as responses and messages already do. Test added.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects UI# conflicts# new-feature# security# Moves a security boundary: sandbox, allowlist, permission or network guard >3000#

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants