Question · Speech recognition
How do you run Whisper in Google Colab?
Open a new Colab notebook, choose a T4 GPU under Change runtime type, install Whisper with pip, and transcribe your file. Free Colab sessions are not guaranteed and can run for at most 12 hours, so download your transcript before the session ends.
Updated October 17, 20263 min read11 cited facts, each traced to its source
Google Colab runs Whisper in a notebook in your browser, with no install on your computer. Create a notebook, switch it to a GPU, install Whisper with one command, and transcribe a file. The free tier works for a single file or a short job, but its GPU is not guaranteed and each session stops after a set time. Save your transcript as you go, and use a local install if you need Whisper every day.
Colab gives free access to GPUs, but the free tier is limited
Colab is a hosted Jupyter Notebook service, and Google says it provides free of charge access to computing resources, including GPUs and TPUs 1. The free access has conditions. Google says that in the free version, access to expensive resources such as GPUs is heavily restricted 2.
Google also says Colab resources are not guaranteed and not unlimited, and that usage limits sometimes change 3. In practice, you may open a notebook and find no GPU available. Plan for that by keeping your transcription steps short.
Set the runtime to a T4 GPU before you install anything
Changing the runtime is the step most people miss. The PyTorch guide to Colab tells you to open the Runtime menu, choose Change runtime type, select T4 GPU under Hardware accelerator, and click Save 4.
Set the runtime first, before you install anything, so that every later cell runs on the GPU. Menu names can change, so check the names against the guide's wording on the day you use it.
Install Whisper with one pip command in a notebook cell
OpenAI's Whisper Colab notebook opens with a cell whose commands install the Python packages needed to use Whisper models and evaluate the transcription results 5. In your own cell, run !pip install -U openai-whisper 6.
To confirm the GPU is visible, run torch.cuda.is_available(), which returns a bool saying whether CUDA is currently available 7. If it returns False, go back to the runtime step.
Use faster-whisper if the ffmpeg install gets in the way
openai-whisper requires the ffmpeg command-line tool on your system, in addition to the Python package 8. If your notebook reports that ffmpeg is missing, you have to install it before Whisper can decode your file.
faster-whisper does not need a separate ffmpeg install, because it decodes audio with the PyAV library, which bundles the FFmpeg libraries 9. For Colab, that makes it the simpler route if you want fewer steps. The same model family runs in both, so the transcript quality depends on the model size you choose, not on the package.
Transcribe your file and save the result before the session ends
Upload your audio to the notebook, then run the transcription. The Whisper README's Python example loads a model and transcribes a file in two lines: model = whisper.load_model("turbo") followed by result = model.transcribe("audio.mp3"). Turbo is a sensible default for English 10, and you can read why in our answer on which Whisper model to use.
Free Colab notebooks run for at most 12 hours, depending on availability and your usage patterns 11. Because the free tier's limits can change, do not count on a long session. Write the transcript to a file and download it as you go, rather than waiting for the last cell to finish.
It depends on whether you need a notebook at all
Colab suits one-off jobs, trying a model, or running Whisper on a machine you do not own. It is a poor fit for a daily routine, because the GPU and the session length are both outside your control. Three cases change the answer.
- One file a month. Colab is fine, since you only need a working session.
- Frequent or long files. A local install with your own GPU, or a computer that runs Whisper on the processor, gives you control over the time limits. The guide to running Whisper locally covers both routes.
- Private recordings. A notebook runs on Google's servers, so the audio leaves your computer. A local run keeps it on your machine, as our guide to Whisper and privacy explains.
If you want a transcript and not a notebook, free file transcription in the browser is a shorter route. For the choice of engine inside a notebook, see whisper.cpp versus faster-whisper, and for the processor-only case, whether Whisper can run without a GPU.
For the subject as a whole, see the speech recognition overview and the guide to Whisper AI.
Evidence
Every number on this page, with where it comes from. Open a fact to see the exact words in its source.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
Go deeper
Related questions
- Can Whisper run without a GPU?
- How do you install Whisper AI?
- What are the best Whisper settings for accuracy?
- What is the best GPU for Whisper?
- What is the best Whisper GUI or desktop app?
- What is the difference between whisper.cpp, faster-whisper and WhisperX?
- Which Whisper model should I use?
- Why is Whisper not using my GPU?