#7593·textgen

Feature: FunASR/SenseVoice STT extension as Whisper alternative

Author: LauraGPTCreated May 31, 2026Updated Jul 23, 2026

Feature request

The built-in whisper_stt extension only supports Whisper models. A local FunASR/SenseVoice extension provides another microphone input option for users who need Mandarin, Cantonese, English, Japanese, or Korean recognition.

Implementation available

The extension follows textgen's current contribution guideline by living in a standalone repository rather than adding its heavier dependencies to the main repository.

Capabilities

  • local iic/SenseVoiceSmall inference
  • auto, zh, yue, en, ja, and ko language selection
  • automatic CPU/CUDA selection, with explicit CUDA failure instead of silent fallback
  • lazy model loading and reuse
  • per-request FunASR cache isolation
  • optional automatic submission after a non-empty transcript
  • attachment preservation in textgen's MultimodalTextbox
  • microphone stream cleanup and recorder-race protection

Validation

  • 11 Python tests, including textgen's pinned gradio==4.37.2+custom.21 MultimodalTextbox contract and complete extension UI construction
  • 7 Node tests covering microphone permission, normal/error cleanup, recorder races, encoding order, and empty auto-submit
  • real browser-style WebM audio transcribed on CPU with funasr==1.3.27, numpy==2.2.6, transformers==5.6.2, and the rest of textgen's critical pins
  • exact smoke-test transcript: 欢迎大家来体验达摩院推出的语音识别模型。
  • pip check, Ruff, Actionlint, JavaScript syntax, and Python compilation pass

Install

Paste the extension repository URL into Session → Install or update an extension, install extensions/funasr_stt/requirements.txt, and enable funasr_stt. FFmpeg must be available on PATH for browser WebM decoding.

FunASR source and this extension are MIT licensed. The default ModelScope iic/SenseVoiceSmall model is Apache-2.0; other model identifiers or local model directories may use different licenses.