Other
openai/whisper: whisper/__init__.py (model download and loading code)
OpenAI, GitHub (openai/whisper, main branch), 2026
Read the originalRead on October 17, 2026
- What it is
- The source code that the openai-whisper Python package runs to download and load a model file. It shows that each downloaded model is checked against a SHA256 checksum and that the PyTorch checkpoint is loaded with weights_only set to True.
- How much weight it carries
- This is the publisher's own code, read on the access date. The code can change between releases, so the behaviour of the version you install may differ. It describes the Python package, not the apps that bundle Whisper.
Facts taken from this source
- When you load a named Whisper model, the openai-whisper loader fetches the model file from its download address with urllib, unless a file with the right checksum is already in the cache folder.
“with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:” (_download function, the download step after the cache check)
- The openai-whisper package checks each model file against a SHA256 checksum and downloads it again when the checksum does not match.
“exists, but the SHA256 checksum does not match; re-downloading the file” (_download function)
- The openai-whisper loader takes the expected SHA256 checksum from the download address of the model, then compares it with the hash of the file saved on disk.
“expected_sha256 = url.split("/")[-2] ... if hashlib.sha256(model_bytes).hexdigest() == expected_sha256:” (_download function in whisper/__init__.py)
- The openai-whisper loader calls torch.load with weights_only set to True on PyTorch 1.13 and later, which restricts what the unpickler will load.
“kwargs = {"weights_only": True} if torch.__version__ >= "1.13" else {}” (load_model function)