Natural Language Processing · Advanced level

Advanced level · Module 8: Automatic Speech Recognition · Lesson 2 of 3

Transcribing Speech with a Pretrained Model

Learners transcribe audio with Whisper through the transformers pipeline, compute word error rate and analyse errors by speaker, noise and language.

In this lesson you will

  • Run pretrained ASR
  • Measure and analyse word error rate

Key concepts

pipeline('automatic-speech-recognition')Whisperword error rate (WER)substitutions, deletions and insertionsper-condition evaluation

The lesson

transformers.pipeline('automatic-speech-recognition', model='openai/whisper-small') transcribes audio files. The whisper-small model card states an Apache-2.0 licence. Small models run on a CPU but slowly; smaller variants are faster and less accurate.

Word error rate is (substitutions + deletions + insertions) divided by the number of words in the reference transcript. Compute it with evaluate.load('wer'). Lower is better; WER can exceed 100% when the output adds many words.

Report WER by condition: quiet versus noisy, each speaker, and each language. The whisper-small model card does not name any South Sudanese language, so transcription of local-language speech should be expected to fail, and must not be presented as working.

Step by step

  1. Transcribe the five test clips.
  2. Write reference transcripts and compute WER for each.
  3. Classify errors as substitutions, deletions or insertions.
  4. Summarise WER by condition and language.

Practice activity

Evaluate pretrained ASR on the test clips and report WER by condition and language.

Expected result: Correct WER figures and an honest summary, including failure on unsupported languages.

Check your understanding

  1. How is word error rate calculated?

    Show answer

    (Substitutions + deletions + insertions) divided by the number of reference words.

  2. Should Whisper be presented as supporting Dinka?

    Show answer

    No. The model card does not name it, and quality has not been evaluated.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.