Skip to content

Studio: open audio models on their Audio page - #12816

Merged
danielhanchen merged 11 commits into
unslothai:mainfrom
Etherll:feat/studio-audio-model-routing
Oct 6, 2026
Merged

danielhanchen merged 11 commits into
unslothai:mainfrom
Etherll:feat/studio-audio-model-routing

Conversation

@Etherll

@Etherll Etherll commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Audio models picked from the chat model picker, run from the Hub inspector, or clicked in Loaded Models now open the Audio page on the workflow that runs them. Before, the chat picker loaded music and separation models into Chat, the Hub had no Run for audio.cpp models, and Loaded Models sent every audio row to Chat, which refuses audio models.

Changes

  • audioPickIsRoutable now gates text-to-audio and audio-to-audio picks to what the Audio page actually runs. audio-to-audio routes only for the separation audio type. text-to-audio routes for a native music family, or for a GGUF that the audio runtime's header classifier tagged, that is a local checkpoint, or that carries audio.cpp evidence in its id, base model, tags or library. MusicGen, Stable Audio, ComfyUI and sa3.cpp GGUFs, codecs and speech enhancers still get the refusal toast, whose copy now says "audio model" instead of "speech model".
  • The chat picker adds text-to-audio and audio-to-audio to AUDIO_GEN_TASKS and marks a downloaded GGUF whose inventory task is text-to-audio with taskFromGgufArch, since only the audio runtime's header classifier assigns that task to a GGUF. The /audio search it builds moved into audioPickSearch in features/audio/route-search.ts so the Hub can reuse it. audioWorkflowForPick maps audio-to-audio to the Separate workflow.
  • The Hub inspector shows Run for a downloaded audio model (speech, transcription, music or separation) that passes the same gate (hubModelRunsOnAudioPage) and navigates to /audio with that search. It hides the llama.cpp memory estimate for these models. The shared audio.cpp repo and filesystem rows with no Hub id keep their existing behavior.
  • Loaded Models labels an audio row in the chat slot by workflow (Music, Separation, Voice conversion, falling back to Speech), opens /audio?workflow=<id> on click, and reports the GGUF audio runtime as "GGUF" instead of "Transformers". It reads the workflow from status.audio_workflows and falls back to the audio type for backends that do not send it. Dictation sidecars still open the Voice settings tab, and Whisper in the chat slot still opens Chat.

Testing

Run in studio/frontend on 7ccf3fc + this commit:

npm run typecheck
npm run i18n:check
npm run build
npm run biome:check
npm test
  • typecheck, i18n:check and build pass. Biome reports no new errors compared to the base.
  • npm test: 10581 of 10583 pass. The two failures (tests/color-themes.test.ts:96 and tests/find-in-page.test.ts:1404) also fail on the base commit.
  • New or updated cases in audio-picker-policy, audio-handoff-intent, hub-media-run-gate, loaded-models-sources, hub-runtime-boundary and model-picker-partial-downloads tests cover the gate, the separate workflow mapping, audioPickSearch, the Hub Run gate (including the audio.cpp repo and filesystem rows), and Loaded Models targets and labels.
  • Manual check with Playwright against a CPU-only Studio, comparing base and head:
    • Picking audio-cpp/Yue2-3B-GGUF q8_0 in the chat picker lands on Audio > Create music and loads the model. On base it stays on Chat.
    • Picking a separation GGUF (a local copy of HTDemucs-GGUF as its own repo) lands on Audio > Separate audio and /api/inference/load returns 200. On base it stays on Chat.
    • The Hub inspector for Yue2 shows Run, which opens Create music. On base there is no Run.
    • The Loaded Models row reads "Separation · GGUF · Q8_0" with an "Open Audio" tooltip and opens Separate audio. On base it reads "Speech · Transformers" and opens Chat.

Screenshots

Base 7ccf3fcb2 (left) vs this branch (right), each Studio on its own install with an isolated Hugging Face cache holding only audio-cpp/Yue2-3B-GGUF Q8_0.

The Hub inspector for the downloaded Yue2 checkpoint: no Run on base, Run on this branch.

Hub inspector, base vs head

After clicking Run: base stays on the Hub; this branch opens Audio > Create music, and /api/inference/status reports audio-cpp/Yue2-3B-GGUF loaded as audiocpp_music with workflows ["music"].

After Run, base vs head

Music and separation picks from the chat picker, Run in the Hub inspector
and a click on an audio row in Loaded Models now open the Audio page on the
workflow that runs the model, instead of loading it into Chat or opening
Chat, which refuses it.

The chat picker routes text-to-audio and audio-to-audio picks only when the
Audio page runs them: a separation GGUF, a native music family, or a GGUF
published for the audio runtime. MusicGen, Stable Audio and other runtimes'
GGUFs keep the existing refusal toast. The Hub uses the same gate and leaves
the shared audio.cpp repo and filesystem rows as they were. Loaded Models
labels audio rows by workflow (Music, Separation, Voice conversion) and reads
the audio runtime as GGUF.
@Etherll
Etherll requested a review from danielhanchen as a code owner October 6, 2026 03:33
@Etherll

Etherll commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Clicking an audio model's Loaded Models row always sent the Audio page to
the model's first workflow. With a model that runs several (Speak and Edit,
say) and the page on another of them, the click switched the tab and would
stop a generation running there. The row now keeps every workflow the model
runs and only names one when the page is on a workflow the model does not run.
@Etherll

Etherll commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

A downloaded non-GGUF speech model on a host without a non-GGUF runtime
(a Mac, for one) now showed Run, which opened the Audio page only for it to
refuse the model. Such a row keeps the Hub's previous behaviour; GGUFs still
open the Audio page.
@Etherll

Etherll commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

This reverts c584de4. Gating the Audio Run on the chat runtime check hid
a working Run for audio models the Audio page does run without it: MiniMax
Music 3 on CUDA (its Hub tags mark it unsupported for chat) and the native
CPU speech models on hosts without a GPU. Where the Audio page cannot load
the checkpoint, it already refuses the pick with a message before loading
anything, as it does for the same pick from the chat model picker.
@Etherll

Etherll commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@Etherll

Etherll commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

Picking a music or separation GGUF in the chat model picker now opens the Audio page on Create music or Separate audio. Run in the Hub opens the same page for a downloaded audio.cpp model, and the Loaded Models row for an audio model opens Audio on its workflow instead of Chat.

What changed

  • The Loaded Models row always sent the Audio page to the model's first workflow. With a Speak and Edit model loaded and the page on Edit, clicking the row switched to Speak and could stop a running generation. The row now leaves the page alone when the model runs that workflow.

Checked in a CPU-only Studio, same backend, only the frontend build swapped. On 7ccf3fcb2 the four flows stay on Chat or show no Run. On 4d309604 they open the right Audio workflow, and Edit stays put after the row click. The frontend test suite shows no new failures against the base. Models loaded on CPU only; the generation stop was traced in code, not run end to end.

Before and after

Before: 7ccf3fcb2 (main). After: 4d309604.

Codex review requested at 04:48 UTC on 4d309604; no response yet.

@danielhanchen

Copy link
Copy Markdown
Member

None of the red checks here look caused by this PR (the run was created at 04:48 UTC):

danielhanchen added a commit that referenced this pull request Oct 6, 2026
…12835)

test_a_closed_request_cancels_the_fetch returned 499 and then drained the
fetch pool with no-ops before reading what the fake fetch saw. Idle workers
finish those no-ops while the fetch's own thread may not have recorded
anything yet, so a loaded CI worker read an empty dict (KeyError 'cancelled'
on #12816, which does not touch the browser route). The fake fetch now sets
an event when it is done and the test waits on that.
@danielhanchen danielhanchen self-assigned this Oct 6, 2026
@danielhanchen

danielhanchen commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Review record for #12816, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#498.

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 febdfc77c (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/frontend/src/features/loaded-models/loaded-models-sources.ts (on the mirror)

@@ -147,15 +194,29 @@ export function describeInferenceStatus(
       audioType !== "whisper" &&
       audioType !== "audio_vlm";
     const isStt = Boolean(status.is_audio) && audioType === "whisper";
-    const runtime = status.is_gguf
-      ? "GGUF"
-      : status.is_mlx
-        ? "MLX"
-        : "Transformers";
+    const audioWorkflows = (status.audio_workflows ?? []).filter(
+      isAudioWorkflowId,
+    );
+    // The GGUF audio runtime reports is_gguf false, but it serves GGUFs too.
+    const runtime =
+      status.is_gguf || AUDIO_CPP_AUDIO_TYPES.has(audioType ?? "")
+        ? "GGUF"
+        : status.is_mlx
+          ? "MLX"
+          : "Transformers";
     entries.push({
       id: `chat:${active}`,
       kind: isTts ? "tts" : isStt ? "stt" : "text",
       source: "chat",
+      // An older backend sends no workflows: the audio type still tells Music from Speak.
+      ...(isTts
+        ? {
+            workflows:
+              audioWorkflows.length > 0
+                ? audioWorkflows
+                : [audioWorkflowForAudioType(audioType)],

P2 Badge Route legacy separation statuses to Separate

When a backend reports a separation model with audio_type: "audiocpp_sep" but omits the newer audio_workflows field, this fallback calls audioWorkflowForAudioType, which only returns speak or music and therefore classifies the model as Speech and opens Speak. The explicit old-backend fallback should recognize the separation audio type and produce separate.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Same as the earlier round: not reachable. audiocpp_sep and the separate status workflow landed together in #12610 and Studio ships the frontend with its own backend, so no backend serves a separation model without audio_workflows.

chatgpt-codex-connector[bot] on studio/frontend/src/features/audio/route-search.ts (on the mirror)

@@ -82,6 +82,8 @@ export function audioWorkflowForPick(pick: {
   task?: string | null;
   audioType?: string | null;
 }): AudioWorkflowId | null {
+  // Only a separation row's audio-to-audio pick is routed here.
+  if (pick.task === "audio-to-audio") return "separate";

P2 Badge Allow audio-to-audio through route validation

For a task-only deep link such as /audio?model=owner/model&task=audio-to-audio, this new mapping never executes because validateAudioSearch still excludes audio-to-audio from AUDIO_ROUTE_TASKS. The task is stripped before useAudioHandoff reads it, so the model does not switch to Separate unless every caller also supplies the redundant workflow=separate; add the newly supported task to the route allowlist.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not reachable from Studio: every in-tree caller builds the route with audioPickSearch, which always sets workflow=separate for an audio-to-audio pick, so the stripped task is never what picks the page.

Round 2: reviewed mirror 32ab90dc6 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/frontend/src/features/hub/lib/model-run-selection.ts (on the mirror)

@@ -107,6 +114,33 @@ function createHandoffMeta(
   return meta;
 }
 
+/** Whether Run opens this model on the Audio page rather than in chat, which refuses audio models.
+ *  Judged on the gate the chat picker routes by, so both surfaces send the same models there. */
+export function hubModelRunsOnAudioPage(
+  model: SelectedModelView,
+  task: string | null,
+): boolean {
+  // A filesystem row has no Hub id for the Audio handoff, so it keeps its chat Run.
+  const id = model.hubRepoId;
+  if (!id || !routableToMediaPage(model.kind, model.localSource)) return false;
+  // The shared GGUF audio repo holds many models; the Audio page lists them one by one.
+  if (id.toLowerCase() === AUDIO_CPP_REPO.toLowerCase()) return false;
+  const audioType = model.audioType ?? null;
+  if (audioWorkflowForPick({ id, task, audioType }) === null) return false;
+  return audioPickIsRoutable({
+    id,
+    task,
+    isGguf: model.isGguf,
+    isCurated: artifactForRepoId(id, AUDIO_CATALOG) !== null,

P2 Badge Apply the macOS TTS runtime gate before routing Hub Run

On macOS, a downloaded safetensors TTS model without a GGUF sibling, such as unsloth/csm-1b, passes here solely because it is curated. That marks it as a media model, bypasses the non-GGUF runtime eligibility check, and exposes Run; after navigation, macTtsPickAction rejects the model because ggufSiblingFor returns null. Apply the same macTtsHubRowIsRunnable/native-runtime gate used by the Audio picker before advertising this Hub Run action.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Below the bar: on macOS the Audio slot refuses that pick with a clear message before any load or eviction, so nothing runs wrongly; matching the picker's gate exactly would need the GGUF sibling inspection the Hub does not have.

Round 3: reviewed mirror 750537a09 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/frontend/src/features/audio/hooks/use-audio-handoff.ts (on the mirror)

@@ -79,6 +80,7 @@ export function useAudioHandoff({
       ggufVariant: routeSearch.ggufQuant ?? undefined,
       loadId: routeSearch.loadId ?? undefined,
       audioType: routeSearch.audioType ?? undefined,
+      isGguf: routeSearch.gguf ?? undefined,

P2 Badge Persist the GGUF engine after the handoff

When Hub Run targets a community audio.cpp ASR GGUF whose repository ID lacks a -GGUF suffix, this flag selects the correct engine only for the initial handleModelSelect call. After that load, useSttSidecar.refreshSttStatus, sttReady, and prepareTranscriptionModel all recompute sttEngineForRepoId(repo) without the flag, defaulting the same repository back to Transformers; the loaded audio.cpp model is consequently considered unready and a transcription attempt can target the wrong sidecar. Fresh evidence beyond the prior resolved comment is this downstream engine recomputation after the now-correct initial load, so the selected engine/format needs to remain associated with the STT selection.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Pre-existing, not introduced here: the Audio page's own picker goes through the same handleModelSelect with meta.isGguf and hits the same sttEngineForRepoId(repo) recomputation in the STT sidecar on main. Keeping the engine with the STT selection is a sidecar change, tracked separately rather than widened into this routing PR.

Round 4: reviewed mirror 1dda942163 (this PR's 3a16b60aa)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 1dda942163

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 1dda942163 (this PR's 3a16b60aa).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 6, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 6, 2026
@danielhanchen
danielhanchen merged commit d229059 into unslothai:main Oct 6, 2026
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.

2 participants