A toolkit for whisper.cpp with audio processing and model management
Project description
WhisperCPP Kit 🎙️
🚀 A Python wrapper around whisper.cpp with model management and helper features.
✨ Features
- 🔄 Automatic building and setup of whisper.cpp
- 🎯 Simple, intuitive Python API
- 🔧 Built-in model management
- 🚦 Clear error messages and dependency checks
- 🎵 Automatic audio format conversion
- 🧵 Multi-threading support
- 🐳 Docker support
- 🎯 Support for custom and fine-tuned models
- ⚡ Cached builds for faster subsequent inference
📋 System Requirements
Before installing whispercpp_kit, ensure you have these system-level dependencies:
Required dependencies 🛠️
gitcmakeffmpegmakeg++/gcc(C++ compiler)- Build essentials
Installation commands 📦
Ubuntu/Debian
sudo apt update
sudo apt install git cmake ffmpeg build-essential
MacOS
brew install git cmake ffmpeg gcc make
CentOS/RHEL
sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install git cmake ffmpeg gcc-c++ make
⚠️ Windows is currently not supported. Please use WSL (Windows Subsystem for Linux) with Ubuntu.
🚀 Quick start
Installation
pip install whispercpp_kit
Basic usage
from whispercpp_kit import WhisperCPP
# Initialize with default model
whisper = WhisperCPP(model_name="tiny.en")
# First-time setup (automatically done on first transcribe)
whisper.setup()
# Transcribe audio
text = whisper.transcribe("audio.mp3")
print(text)
Advanced configuration
# Using standard models
whisper = WhisperCPP(
model_name="tiny.en",
num_threads=8, # Control threads number
verbose=True, # Enable verbose output
cache_dir="./cache" # Custom cache directory
)
# Using custom or fine-tuned models
whisper = WhisperCPP(model_path="/path/to/your/fine-tuned-model.bin")
# The library caches the built whisper.cpp source code
# This means subsequent runs will be faster as compilation is skipped
🐳 Troubleshooting
Rebuilding whisper.cpp
If you encounter issues with the whisper.cpp binary, you can force a rebuild:
import shutil
from whispercpp_kit import WhisperCPP
whisper = WhisperCPP(model_name="tiny.en")
# Force rebuild of whisper.cpp
shutil.rmtree(whisper.base_path)
whisper.setup()
Common Issues
-
Binary Deprecation Warning: If you see a warning about the 'main' binary being deprecated, rebuild whisper.cpp using the steps above. The latest version uses 'whisper-cli' instead.
-
Transcription Failures: Ensure you have all required dependencies installed and sufficient permissions to execute the binary.
-
Audio Format Issues: The library automatically converts audio files using ffmpeg. Make sure ffmpeg is properly installed if you encounter audio-related errors.
🐳 Docker support
Docker Instructions
git clone https://github.com/s-emanuilov/whispercpp_kit
cd whispercpp_kit/examples/docker
# Build the image
docker build -t whispercpp_kit .
# Run with default model (base.en)
docker run -v $(pwd):/app/audio whispercpp_kit your_audio.mp3
# Using specific model
docker run -v $(pwd):/app/audio whispercpp_kit your_audio.mp3 tiny.en
See examples/docker/README.md for more details.
📝 License
MIT License - feel free to use in your projects!
🤝 Contributing
Contributions are welcome! Feel free to submit issues and pull requests.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whispercpp_kit-0.1.7.tar.gz.
File metadata
- Download URL: whispercpp_kit-0.1.7.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d46af335855f81fd7aa059d3c6119a8c1c44a293653774043d314ba79a072936
|
|
| MD5 |
82be3fdf39dd9fd4ebaab544f37cb0d5
|
|
| BLAKE2b-256 |
7c576f81d91bf61af5216f0419a978d68ba638b973f6a501900909250186e085
|
File details
Details for the file whispercpp_kit-0.1.7-py3-none-any.whl.
File metadata
- Download URL: whispercpp_kit-0.1.7-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
577daaa340c9a532277d21c9e44a2baa939c208de24bd27e6b8a870c89d8eb2b
|
|
| MD5 |
91a875add22cfb424bf01f39e8e894a2
|
|
| BLAKE2b-256 |
a1e70c49107bccdf5c42010a3f06390a1987c478a6eefe68e5ac4a2c777e960c
|