Skip to content

vllm.model_executor.models.transformers.transcription

Transformers modeling backend mixin for the transcription API.

_decode(text, model_config, **options)

Parse the raw model output with the HF processor, if it knows how to.

Source code in vllm/model_executor/models/transformers/transcription.py
def _decode(text: str, model_config: "ModelConfig", **options: Any) -> Any:
    """Parse the raw model output with the HF processor, if it knows how to."""
    processor = cached_processor_from_config(model_config)
    supported = inspect.signature(processor.decode).parameters
    if not (options := {k: v for k, v in options.items() if k in supported}):
        return text
    ids = processor.tokenizer.encode(text, add_special_tokens=False)
    return processor.decode([ids], **options)[0]