Model Requirements
Custom models must be converted to CoreML format compatible with WhisperKit. The models consist of:Audio Encoder
Mel spectrogram to embeddings
Text Decoder
Embeddings to text tokens
Tokenizer
Text encoding/decoding
WhisperKit Tools
Thewhisperkittools Python package provides utilities to:
- Convert Hugging Face Whisper models to CoreML
- Fine-tune models on custom datasets
- Optimize models for specific Apple devices
- Deploy models to Hugging Face Hub
Installation
Converting Models
From Hugging Face Hub
Convert any Whisper model from Hugging Face:From Local Checkpoint
Convert a locally fine-tuned model:Conversion Options
string
Hugging Face model ID (e.g.,
openai/whisper-large-v3)string
Path to local model checkpoint
string
Directory to save converted models
string
default:"cpuAndNeuralEngine"
Target compute units:
cpuOnly, cpuAndGPU, cpuAndNeuralEngine, allstring
Quantization mode:
linear, palettize, or noneFine-Tuning Models
Preparing Your Dataset
Dataset should be in Hugging Face Datasets format with audio and transcription:Training Example
Deploying to Hugging Face
After converting your model to CoreML, upload to Hugging Face Hub:Loading Custom Models
From Hugging Face Hub
Once uploaded, load your custom model in WhisperKit:From Local Path
Load models from local filesystem:With Compute Options
Model Repository Structure
Your Hugging Face repository should follow this structure:Model Variants
WhisperKit supports glob patterns for model selection:openai_whisper-*- Original OpenAI modelsdistil-whisper-*- Distilled models (faster, slightly lower accuracy)
Optimization Techniques
Quantization
Reduce model size and improve inference speed:Model Pruning
Remove unnecessary weights during fine-tuning:Knowledge Distillation
Create smaller models from larger ones:Testing Custom Models
CLI Testing
Programmatic Testing
Benchmarking
Compare your custom model against baselines:Best Practices
Model Selection
- Start with
openai/whisper-smallfor fine-tuning (good balance) - Use
large-v3for highest accuracy,tinyfor fastest inference - Consider distil models for production (2-3x faster)
Fine-Tuning
- Use domain-specific data (medical, legal, technical)
- Include background noise similar to deployment environment
- Balance dataset across accents and speakers
- Fine-tune for 2-5 epochs to avoid overfitting
Optimization
- Apply quantization for models > 200MB
- Target
cpuAndNeuralEnginefor macOS 14+ deployment - Use
cpuAndGPUfor older macOS versions - Test on target devices before deployment
Validation
- Measure Word Error Rate (WER) on held-out test set
- Test edge cases (accents, noise, domain terms)
- Compare against baseline OpenAI models
- Profile memory usage and inference time
Example: Medical Transcription Model
Complete workflow for creating a medical transcription model:Resources
WhisperKit Tools
Python toolkit for model conversion
Model Hub
Pre-converted WhisperKit models
Hugging Face Whisper
Browse available Whisper models
Fine-tuning Guide
Official Whisper fine-tuning guide
Next Steps
Performance Optimization
Optimize custom model performance
Memory Management
Manage memory for large models