FREE & OFFLINE Audio to Text | Whisper: Install Guide | OpenAI Whisper | ASR

3 min read 4 hours ago
Published on Dec 23, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you will learn how to install OpenAI’s Whisper, a powerful audio-to-text transcription tool that works offline and is completely free. By following this guide, you will be able to transcribe audio files into text in various languages directly from your computer, without any subscriptions or fees.

Step 1: Check if Python is Installed

Before you can install Whisper, you need to ensure that Python is installed on your machine.

  • Open a command prompt (Windows) or terminal (Mac/Linux).
  • Type the following command to check the Python version:
    python --version
    
  • If Python is not installed or if the version is below 3.9.9, proceed to download the latest version.

Step 2: Download Python 3.9.9

To download Python, follow these steps:

  1. Visit the official Python download page at Python 3.9.9.
  2. Choose the installer that matches your operating system (Windows, Mac, or Linux).
  3. Run the installer and ensure to check the box that says "Add Python to PATH" during installation.

Step 3: Handle Multiple Python Versions

If you have multiple versions of Python installed, you can specify which version to use.

  • Use the command:
    python3.9 --version
    
  • This ensures you're using the correct version (3.9.9) for Whisper.

Step 4: Install CUDA for NVIDIA Users

If you are using an NVIDIA GPU, install CUDA for better performance with Whisper.

  1. Go to the CUDA 11.6 download page.
  2. Download and install the appropriate version for your operating system.
  3. Follow any specific instructions provided during the installation process.

Step 5: Install PyTorch

Whisper relies on PyTorch, which needs to be installed next.

  1. Visit the PyTorch installation page.
  2. Select your preferences (OS, package manager, Python version, and CUDA version).
  3. Copy the provided installation command and run it in your command prompt or terminal. It will look something like this:
    pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
    

Step 6: Install FFMPEG

FFMPEG is essential for processing audio files. Here’s how to install it:

  1. Go to the FFMPEG download page.
  2. Download the build suitable for your operating system.
  3. Follow the installation instructions provided on the site. Ensure that FFMPEG is added to your system PATH to access it from the command line.

Step 7: Install Whisper

Now that all prerequisites are in place, you can install Whisper.

  1. Open your command prompt or terminal.
  2. Run the following command:
    pip install git+https://github.com/openai/whisper.git
    
  3. Wait for the installation to complete.

Step 8: Get Help and Command Reference

To familiarize yourself with Whisper's commands:

  • Type the following command in your terminal:
    whisper --help
    
  • This will display a list of available commands and usage instructions.

Step 9: Basic Whisper Usage

To transcribe audio files using Whisper:

  1. Use the following command to transcribe an MP3 file:
    whisper your_audio_file.mp3 --language English
    
  2. Replace your_audio_file.mp3 with the path to your audio file.

Step 10: Transcribe MP3 to Text

Follow these steps to transcribe your audio:

  1. Ensure your audio file is ready and located in an accessible directory.
  2. Run the transcription command as shown in Step 9.
  3. The output will be saved as a text file in the same directory as the audio file.

Conclusion

You've successfully installed OpenAI's Whisper and learned how to transcribe audio files into text. This tool is a powerful resource for anyone needing offline transcription capabilities. Experiment with different audio files and languages to fully utilize Whisper's capabilities. If you encounter any issues, consult the command reference for troubleshooting tips. Happy transcribing!