To run the Whisper CLI on Windows, you have two main options: using the official Python package with pip or using the standalone executables provided by the C++ port, whisper.cpp. The Python method offers direct installation, while whisper.cpp provides better performance on CPU hardware.
Option 1: Using the Official Python Package (Recommended for most users)
This method involves using Python's package manager (
pip) to install the official OpenAI Whisper library, which includes a command-line interface. Prerequisites:
- Python: Install Python 3.8 or later from the official website. Ensure you check the box that says "Add Python to PATH" during installation.
- FFmpeg: This tool is required for handling various audio formats.
- The easiest way to install it on Windows is using the package manager Chocolatey.
- Open PowerShell as an administrator and run:
choco install ffmpeg. - Alternatively, you can manually download FFmpeg and add it to your system's environment variables (PATH).
- PyTorch (Optional for GPU acceleration): If you have an NVIDIA GPU, install CUDA-compatible PyTorch for much faster transcription. Follow instructions on the PyTorch website. For CPU-only, the
pip installcommand will install the necessary CPU version automatically.
Installation Steps:
- Open your Command Prompt or PowerShell.
- Install the Whisper package using
pip:To ensure you have the latest version directly from the source, you can use this command instead: - Verify the installation by running:
Usage Example:
Transcribe an audio file named
Transcribe an audio file named
audio.mp3 using the small model: Option 2: Using
whisper.cpp (For CPU performance and standalone use) whisper.cpp is a C++ port that runs very efficiently on a CPU, often faster than the Python version. Standalone CLI executables are available, eliminating the need to install Python or manage dependencies manually. - Download: Go to the whisper.cpp releases page on GitHub and download a pre-built Windows binary (e.g.,
whisper-bin-x64.zip). - Extract: Extract the contents of the ZIP file to a folder (e.g.,
C:\ai\whisper.cpp). - Install C++ Redistributable: Ensure you have the latest Microsoft Visual C++ Redistributable installed, as it is a necessary dependency.
- Download a Model: Download a pre-trained model file in the
ggmlformat from the Hugging Face repository (e.g.,ggml-base.en.bin) and place it in yourwhisper.cppfolder. - Run: Open a Command Prompt in the extracted folder and run the executable with your model and audio file.(Note: You might need to place your audio file in the same directory or specify its full path.)
沒有留言:
張貼留言