Skip to content

vllm.entrypoints.speech_to_text.base.serving

Classes:

Functions:

SpeechToTextBaseServing

Bases: GenerateBaseServing

Base class for speech-to-text operations like transcription and translation.

_create_speech_to_text(audio_data, request, raw_request, response_class, stream_generator_method) async

Base method for speech-to-text operations like transcription and translation.

_detect_language(audio_chunk, request_id, data_parallel_rank=None) async

Auto-detect the spoken language from an audio chunk.

Delegates prompt construction and output parsing to the model class via get_language_detection_prompt and parse_language_detection_output.

_get_decoder_prompt_len(engine_inputs) staticmethod

Get the length of the decoder prompt. Currently we need to offset by the decoder prompt length when running beam search because the mm encoder is not currently cached and runs on decode calls; because of this, we need to make sure the redundant encoder calls won't exceed the context :(

FIXME (Alex) - this will be removed in the very near future once the encoder/decoder caching is implemented.

_get_verbose_segments(tokens, log_probs, request, segment_class, start_time=0)

Convert tokens to verbose segments.

This method expects the model to produce timestamps as tokens (similar to Whisper). If the tokens do not include timestamp information, the segments may not be generated correctly.

Note: No_speech_prob field is not supported in this implementation and will be None. See docs for details.

asr_inter_chunk_separator(language, no_space_languages)

Space to insert between ASR text chunks for streaming and non-streaming join.

Languages in no_space_languages (e.g. Chinese, Japanese) use an empty separator; others use a single ASCII space.