# openai/whisper architecture

> Architecture diagram of the GitHub repository openai/whisper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openai/whisper
- Repository: https://github.com/openai/whisper

## Overview

Whisper is a speech-recognition and speech-translation package. Users provide audio through the Python API or CLI; the transcription workflow prepares audio, runs the model and decoding, and returns text segments, optionally with word timings and subtitle files. The README also documents language identification and multilingual translation. Edges reflect README statements and the supplied source excerpts or SOURCE INDEX; normalizer and some optional implementation details are shown without inferred workflow links.

Main entry points: [`whisper/transcribe.py`](https://github.com/openai/whisper/blob/main/whisper/transcribe.py) (API and CLI), [`whisper/timing.py`](https://github.com/openai/whisper/blob/main/whisper/timing.py) (Word timing), [`whisper/audio.py`](https://github.com/openai/whisper/blob/main/whisper/audio.py) (Audio decoding), [`whisper/decoding.py`](https://github.com/openai/whisper/blob/main/whisper/decoding.py) (Task decoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_entrypoint["API and CLI<br/>[transcribe.py]"]
  node_loader["Model loader<br/>[__init__.py]"]
end

subgraph group_audio["Audio preparation"]
  node_audio_input["Audio decoding<br/>[audio.py]"]
  node_features["Log-Mel features<br/>[audio.py]"]
  node_audio_utils["Audio utilities<br/>[utils.py]"]
end

subgraph group_inference["Model inference"]
  node_transformer["Transformer model<br/>[model.py]"]
  node_decoder["Task decoding<br/>[decoding.py]"]
  node_tokenizer["Task tokenizer<br/>[tokenizer.py]"]
end

subgraph group_results["Results and text"]
  node_timing["Word timing<br/>[timing.py]"]
  node_triton["Triton kernels<br/>[triton_ops.py]"]
  node_normalizer_basic["Basic normalization<br/>[basic.py]"]
  node_normalizer_english["English normalization<br/>[english.py]"]
  node_output["Transcript outputs<br/>[utils.py]"]
end

node_user(("User"))
node_model_host(("Model download host"))
node_audio_file["Audio file"]

node_user -->|"submits audio"| node_entrypoint
node_entrypoint -->|"loads audio"| node_audio_input
node_entrypoint -->|"builds features"| node_features
node_audio_input -->|"reads"| node_audio_file
node_audio_input -->|"uses"| node_audio_utils
node_entrypoint -->|"decodes tasks"| node_decoder
node_decoder -->|"runs inference"| node_transformer
node_decoder -->|"uses tokens"| node_tokenizer
node_entrypoint -->|"selects task tokens"| node_tokenizer
node_entrypoint -->|"aligns words"| node_timing
node_timing -->|"reads attention"| node_transformer
node_timing -->|"splits word tokens"| node_tokenizer
node_timing -->|"uses kernels"| node_triton
node_entrypoint -->|"writes results"| node_output
node_loader -->|"constructs model"| node_transformer
node_loader -->|"downloads weights"| node_model_host
node_normalizer_english -->|"extends"| node_normalizer_basic

click node_entrypoint "https://github.com/openai/whisper/blob/main/whisper/transcribe.py"
click node_loader "https://github.com/openai/whisper/blob/main/whisper/__init__.py"
click node_audio_input "https://github.com/openai/whisper/blob/main/whisper/audio.py"
click node_features "https://github.com/openai/whisper/blob/main/whisper/audio.py"
click node_audio_utils "https://github.com/openai/whisper/blob/main/whisper/utils.py"
click node_transformer "https://github.com/openai/whisper/blob/main/whisper/model.py"
click node_decoder "https://github.com/openai/whisper/blob/main/whisper/decoding.py"
click node_tokenizer "https://github.com/openai/whisper/blob/main/whisper/tokenizer.py"
click node_timing "https://github.com/openai/whisper/blob/main/whisper/timing.py"
click node_triton "https://github.com/openai/whisper/blob/main/whisper/triton_ops.py"
click node_normalizer_basic "https://github.com/openai/whisper/blob/main/whisper/normalizers/basic.py"
click node_normalizer_english "https://github.com/openai/whisper/blob/main/whisper/normalizers/english.py"
click node_output "https://github.com/openai/whisper/blob/main/whisper/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entrypoint,node_loader,node_user toneBlue
class node_audio_input,node_features,node_audio_utils toneAmber
class node_transformer,node_decoder,node_tokenizer toneMint
class node_timing,node_triton,node_normalizer_basic,node_normalizer_english,node_output toneRose
class node_model_host,node_audio_file toneIndigo
```

## Components

### User entry

- [API and CLI](https://github.com/openai/whisper/blob/main/whisper/transcribe.py): `whisper/transcribe.py`
- [Model loader](https://github.com/openai/whisper/blob/main/whisper/__init__.py): `whisper/__init__.py`

### Audio preparation

- [Audio decoding](https://github.com/openai/whisper/blob/main/whisper/audio.py): `whisper/audio.py`
- [Log-Mel features](https://github.com/openai/whisper/blob/main/whisper/audio.py): `whisper/audio.py`
- [Audio utilities](https://github.com/openai/whisper/blob/main/whisper/utils.py): `whisper/utils.py`

### Model inference

- [Transformer model](https://github.com/openai/whisper/blob/main/whisper/model.py): `whisper/model.py`
- [Task decoding](https://github.com/openai/whisper/blob/main/whisper/decoding.py): `whisper/decoding.py`
- [Task tokenizer](https://github.com/openai/whisper/blob/main/whisper/tokenizer.py): `whisper/tokenizer.py`

### Results and text

- [Word timing](https://github.com/openai/whisper/blob/main/whisper/timing.py): `whisper/timing.py`
- [Triton kernels](https://github.com/openai/whisper/blob/main/whisper/triton_ops.py): `whisper/triton_ops.py`
- [Basic normalization](https://github.com/openai/whisper/blob/main/whisper/normalizers/basic.py): `whisper/normalizers/basic.py`
- [English normalization](https://github.com/openai/whisper/blob/main/whisper/normalizers/english.py): `whisper/normalizers/english.py`
- [Transcript outputs](https://github.com/openai/whisper/blob/main/whisper/utils.py): `whisper/utils.py`

### Other components

- **User**
- **Model download host**
- **Audio file**

## Connections

- User → API and CLI: submits audio (evidence: `README.md`)
- API and CLI → Audio decoding: loads audio (evidence: `whisper/transcribe.py`)
- API and CLI → Log-Mel features: builds features (evidence: `whisper/transcribe.py`)
- Audio decoding → Audio file: reads (evidence: `whisper/audio.py`)
- Audio decoding → Audio utilities: uses (evidence: `whisper/audio.py`)
- API and CLI → Task decoding: decodes tasks (evidence: `whisper/transcribe.py`)
- Task decoding → Transformer model: runs inference (evidence: `whisper/decoding.py`)
- Task decoding → Task tokenizer: uses tokens (evidence: `whisper/decoding.py`)
- API and CLI → Task tokenizer: selects task tokens (evidence: `whisper/transcribe.py`)
- API and CLI → Word timing: aligns words (evidence: `whisper/transcribe.py`)
- Word timing → Transformer model: reads attention (evidence: `whisper/timing.py`)
- Word timing → Task tokenizer: splits word tokens (evidence: `whisper/timing.py`)
- Word timing → Triton kernels: uses kernels (evidence: `whisper/timing.py`)
- API and CLI → Transcript outputs: writes results (evidence: `whisper/transcribe.py`)
- Model loader → Transformer model: constructs model (evidence: `whisper/__init__.py`)
- Model loader → Model download host: downloads weights (evidence: `whisper/__init__.py`)
- English normalization → Basic normalization: extends (evidence: `whisper/normalizers/english.py`)
