Skip to content

test(studio): preserve resident Whisper chat transcription - #10077

Closed
Imagineer99 wants to merge 3 commits into
unslothai:mainfrom
Imagineer99:fix/chat-whisper-autoload-guard
Closed

Imagineer99 wants to merge 3 commits into
unslothai:mainfrom
Imagineer99:fix/chat-whisper-autoload-guard

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Preserve the existing resident Whisper chat transcription behavior. Whisper stays eligible for chat adoption: text-only turns return an explicit HTTP 400 asking for an audio file, while audio uploads return transcript text.

Restore the Whisper exception removed by the initial commit and add regression coverage for adopting a resident Whisper model, retaining an existing selection, the text-only error, and streaming/non-streaming transcription responses. TTS residents remain excluded, and cached ASR models remain excluded from automatic chat loading. The net change is regression coverage, with no product behavior change.

Validation: 31 frontend tests and 10 focused backend tests pass. The original guard fails the Whisper adoption checks, which pass with the exception restored. Python lint, whitespace checks, the worktree audit, and the pre-push gate passed.

Live validation on the PR head also passed with unsloth/whisper-large-v3 on an RTX 5070 Ti: the expected text-only 400, real decoding/resampling of OpenAI Whisper's 11-second JFK FLAC fixture, correct non-streaming and streaming transcription, preserved residency, and audio upload/rendered transcription through Chromium's chat UI. Warm API streaming took 4.81 seconds; the UI reported 5.14 seconds. The live run used no decoder/inference stubs. The local environment initially lacked TorchCodec's libnppicc.so.13; NVIDIA NPP 13.0.2.21 was added only to the disposable test runtime to complete validation.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 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-09-14T16:33:58.881244Z be33e54 New commits
ℹ️ 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: 409bbc4568

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

status.audio_type !== "whisper" &&
status.audio_type !== "audio_vlm"
);
return Boolean(status.is_audio) && status.audio_type !== "audio_vlm";

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 Classify Whisper by audio type before the TTS flag

When the resident checkpoint is a GGUF Whisper model, this still returns false: LlamaCppBackend._apply_detected_audio deliberately preserves _audio_type = "whisper" while leaving _is_audio false (studio/backend/core/inference/llama_cpp.py:31607-31612), and /inference/status forwards both through _llama_runtime_fields. Consequently all three adoption paths continue treating that Whisper resident as a chat model and can submit a text-only turn to it. Check audio_type === "whisper" independently of is_audio (while retaining the audio_vlm exception), and cover the real { is_audio: false, audio_type: "whisper" } status shape.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member

This also makes a resident Whisper checkpoint get dropped by the chat runtime at use-chat-model-runtime.ts:517, which is the model the composer's audio attachment gate at shared-composer.tsx:2368 relies on. Could you confirm in-chat audio transcription still works with a Whisper model resident before I review?

@danielhanchen

Copy link
Copy Markdown
Member

main deliberately exempts whisper here because the chat route branches on it separately, and use-chat-model-runtime.ts:590 would now evict the Audio page's resident Whisper and clear the chat pick; could you confirm what a text turn against a resident Whisper actually returns today, and that the audio-input transcription path in chat still works after this?

@Imagineer99 Imagineer99 changed the title fix(studio): keep speech models out of chat autoload test(studio): preserve resident Whisper chat transcription Sep 14, 2026
@Imagineer99

Imagineer99 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member Author

You're right: Whisper needs to remain exempt here. A text-only turn against resident Whisper returns HTTP 400 with Whisper models require audio input. Please upload an audio file. It does not synthesize the text or attempt a normal chat completion.

With audio_base64, the chat route calls generate_whisper_response and returns the transcript as assistant content, including through SSE. The proposed guard leaves that backend route intact but prevents resident Whisper adoption and clears an existing local chat pick on status refresh. That breaks the intended UI path. Single chat accepts audio through Add photos & files; the compare composer has a separate Upload audio action. The status refresh itself does not call the backend unload endpoint.

Restored the Whisper exception in be33e54 and added regression coverage for adopting/preserving resident Whisper, the text-only 400, and streaming/non-streaming transcript responses. TTS rejection and the cached ASR auto-load exclusion stay in place.

Validation: 31 frontend tests and 10 focused backend tests pass. These unit tests stub decoding and the model worker. The original PR guard fails the Whisper adoption checks. Restoring the exception passes them.

Also verified live on be33e54 with resident unsloth/whisper-large-v3 on an RTX 5070 Ti and OpenAI Whisper's 11-second JFK FLAC fixture:

  • Text-only chat returned the exact HTTP 400 above.
  • Real FLAC decoding/resampling and GPU inference returned the correct JFK transcript in both non-streaming and streaming chat completions. Warm streaming took 4.81 seconds, and Whisper remained resident.
  • In Chromium, chat adopted the resident model, Add photos & files accepted the FLAC, and Send produced the correct visible transcript: “And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.” The UI reported 5.14 seconds.

The initial live audio request exposed a local TorchCodec dependency issue: libnppicc.so.13 was missing. The successful run used NVIDIA NPP 13.0.2.21 installed only in the disposable test directory and added to that server's library path. No decoder/inference stubs or product-code changes were used for the live checks. The test servers were stopped afterward.

This removes the PR's behavior change. I've updated the title and description to present the remaining change as regression coverage for the existing Whisper chat contract.

@Imagineer99

Copy link
Copy Markdown
Member Author

Closing this to trim the backlog. Main already has the intended Whisper behavior; this only adds regression tests.

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.

2 participants