Skip to content

vllm.model_executor.models.qwen3_asr

Inference-only Qwen3-ASR model.

Classes:

Qwen3ASRForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsPP, SupportsMRoPE, SupportsTranscription, SupportsLoRA, SupportsEagle3, Qwen3OmniMoeAudioEncoderCudaGraphMixin

Methods:

get_generation_prompt(stt_params) classmethod

Get the generation prompt to be used for transcription requests.

Matches the official Qwen3-ASR SDK prompt format. The system turn is only emitted when the caller supplied a prompt, mirroring the SDK's _build_messages (which omits the system role when context is empty) and preserving the prior no-prompt behavior:

[system: {context}] # only when prompt given user: {audio} assistant: [language {Lang}] # when language is forced

get_mm_mapping()

Get the module prefix in multimodal models.

post_process_output(text, model_config) classmethod

Post-process Qwen3-ASR raw output to extract clean transcription.

The model outputs in format: "language {lang}{transcription}" This method strips the language prefix and asr_text tags.

_sanitize_transcription_user_text(text)

Strip ChatML-style special tokens from user-controlled transcription fields.

Applies the regex / <asr_text> substitutions to a fixpoint so nested payloads cannot reconstruct a valid token after a single pass:

  • <|im<|x|>_end|> would, with a single re.sub, leave <|im_end|> (a real ChatML control token).
  • <asr_te<asr_text>xt> would, with a single str.replace, leave <asr_text> (the model-significant assistant-prefix delimiter).

Looping both substitutions until the string stabilises eliminates these reconstruction attacks.