faster-whisper decodes audio in chunks, and by default each chunk can forget what came before. The condition_on_previous_text setting, on by default, feeds the previous chunk’s text into the next one, so names, technical terms and numbers stay consistent through a recording. This guide shows the difference it makes on a recording that repeats a name.
Before you start
- Python with faster-whisper installed.
- An audio clip where the same unusual name or term appears several times.
- A terminal and a text editor.
Prepare the clip
Use a clip of at least two minutes in which the same name or term appears three or more times, for example a product name or a person’s surname. Write the name down exactly as spoken.
Transcribe with the setting on
Run the transcription with the default, which is on:
from faster_whisper import WhisperModel
model = WhisperModel("base", device="cpu", compute_type="int8")
segments, info = model.transcribe("clip.wav", condition_on_previous_text=True)
for s in segments:
print(s.text)
Save the output.
Turn it off and compare
Run the same clip with condition_on_previous_text=False and save that output. Compare how the repeated name is spelled in each run. With the setting on, the spelling should be the same every time; with it off, it may change from one occurrence to the next.
Worked example
Worked example: a clip that says the surname “Kowalski” four times. With the setting on, all four should read “Kowalski”; with it off, you may see “Kowalski” twice and “Kovalsky” or “Kowalsky” in the other places. Count the consistent spellings in each run to see the difference.
Expected result
UNTESTED in this guide: no transcription was run while writing it. The expected result is that the name is spelled the same way in every occurrence with the setting on, and may vary with it off.
Limitations
Conditioning on previous text can also carry a mistake forward: if the first occurrence is wrong, the rest may copy the wrong spelling. If a name is wrong throughout, turn the setting off and check the first occurrence alone.
