PyTorch is the machine studying library required to run Whisper. The M2 chip makes use of Apple Silicon, so we’ll set up PyTorch with MPS (Metallic Efficiency Shaders) help to make the most of the GPU capabilities.
Create a Python Digital Atmosphere (Elective however Advisable):
It’s an excellent apply to make use of a digital atmosphere to handle your Python packages.
python3 -m venv whisper_env
supply whisper_env/bin/activate
Your immediate ought to now point out that you just’re within the whisper_env atmosphere.
Set up PyTorch
PyTorch has added help for MPS in model 1.12 and later. Because you’re utilizing macOS, you may set up PyTorch through pip with MPS help.
Set up PyTorch nightly construct (Advisable for MPS help):
pip set up --pre torch torchvision torchaudio --index-url <https://obtain.pytorch.org/whl/nightly/cpu>
Observe: The above command installs the newest nightly construct with CPU help. For MPS help, use:
pip set up torch torchvision torchaudio
Nonetheless, for MPS (GPU) help, be certain that your macOS model is 12.3 or later, and you’ve got Python 3.10 or later.
Confirm the set up:
python -c "import torch; print(torch.__version__)"
Check MPS Assist
Examine if PyTorch can detect the MPS system:
python -c "import torch; print(torch.backends.mps.is_available())"
If it returns True, MPS is on the market.
Set up Whisper
Now, set up the Whisper package deal:
pip set up git+https://github.com/openai/whisper.git
Alternatively, you may set up through pip immediately:
pip set up -U openai-whisper
Observe: The -U
flag ensures you are putting in the newest model.
Confirm the set up:
whisper --help
You need to see the assistance message for the Whisper CLI software.