Workflow
Step 1: Export
Each model directory contains a conversion script (e.g.,convert-parakeet.py, convert-coreml.py). The script:
- Loads the original PyTorch / NeMo / ONNX model
- Traces or scripts the model with fixed input shapes
- Converts to CoreML using
coremltools - Saves
.mlpackagefiles
Fixed Input Shapes
CoreML requires static shapes at export time. Each model defines its input contract:Step 2: Validate
Parity scripts run the PyTorch and CoreML models side-by-side on identical inputs, comparing outputs numerically and measuring latency.- Numerical diff — max absolute error, max relative error, match/no-match per component
- Latency comparison — Torch CPU vs CoreML (CPU+ANE) with speedup ratios
- Plots — visual comparisons saved to
plots/directory - metadata.json — structured results for CI and reporting
Example Parity Results (Parakeet TDT v3)
Step 3: Quantize (Optional)
Quantization reduces model size and can improve latency on ANE. The sweep evaluates multiple strategies and reports the trade-offs.Quantization Strategies
Results are saved to
quantization_summary.json with per-component quality scores (1.0 = identical to baseline).
Common CoreML Modifications
PyTorch models often need modifications for CoreML tracing. Common patterns:Adding a New Model
- Create the directory:
models/{class}/{name}/coreml/ - Add
pyproject.tomlwith dependencies - Write
convert-*.py— export script - Write
compare-*.py— validation script (optional but recommended) - Add
README.mddocumenting the conversion - Push converted weights to Hugging Face
Deployment Targets
- Minimum: iOS 17 / macOS 14
- Format: MLProgram (
.mlpackagefor development,.mlmodelcfor compiled) - Compute units: Models traced with
CPU_ONLYfor determinism; runtime compute units set when loading (.cpuAndNeuralEngine,.cpuAndGPU,.all)