openai/whisper
Translation
Whisper can translate non-English speech directly into English text. The same model that transcribes also translates — translation is selected by the <|translate|> task token in the start-of-transcript prefix, instead of <|transcribe|>.
Surfaces
CLI:
whisper japanese.wav --model medium --language Japanese --task translatePython:
result = model.transcribe("japanese.wav", language="ja", task="translate")The output result["text"] is in English; result["language"] still reports the detected source language ("ja").
What models support translation
- All multilingual models (
tiny,base,small,medium,large-v1,large-v2,large-v3). - Not the
turbomodel. The README spells this out: "theturbomodel is not trained for translation tasks". Even when called with--task translate,turboreturns the original language. For best translation usemediumorlarge.
The English-only models (tiny.en, base.en, …) cannot translate at all.
How translation is wired in
The token prefix Whisper feeds the decoder is built by Tokenizer.__post_init__ in whisper/tokenizer.py:
sot_sequence = [<|startoftranscript|>]
if language is not None:
sot_sequence.append(<|<lang>|>)
if task is not None:
sot_sequence.append(<|transcribe|> if task == "transcribe" else <|translate|>)get_tokenizer(multilingual=True, language="ja", task="translate") returns a Tokenizer whose sot_sequence ends with the <|translate|> token. DecodingTask uses that prefix to seed the decoder, so every subsequent autoregressive step is conditioned on "the user wants English from this language."
Caveats
- Word timestamps for translations are explicitly flagged as unreliable by the code:
whisper/transcribe.pyemitswarnings.warn("Word-level timestamps on translations may not be reliable.")when both--word_timestampsand--task translateare used. Because the alignment between source-language audio and English target text isn't 1-1, the DTW alignment heuristic won't be as tight as for transcription. - The translation target is always English; there is no path to translate into other target languages with the published models.
See also
- Tokenizer — how the SOT sequence is assembled.
- Decoding — how the prefix conditions the decoder.
- Reference: models — model-by-model capabilities table.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.