Overview
Thefrom_pretrained() function is the primary way to load Parakeet models. It downloads models from Hugging Face Hub and automatically detects the model variant (TDT, RNNT, CTC, or TDT-CTC).
Function Signature
Parameters
Hugging Face repository ID (e.g.,
"mlx-community/parakeet-tdt-0.6b-v3") or path to a local model directory containing config.json and model.safetensors.Data type for model weights. Common options:
mx.bfloat16(default) - Recommended for Apple Silicon, good balance of speed and accuracymx.float32- Higher precision, slower inferencemx.float16- Faster but may have numerical stability issues
Directory to cache downloaded models. If
None, uses Hugging Face’s default cache location (~/.cache/huggingface/hub or the value of HF_HOME/HF_HUB_CACHE environment variables).Returns
Returns one of the following model instances based on the config:
ParakeetTDT- Token-and-Duration Transducer modelParakeetRNNT- RNN-Transducer modelParakeetCTC- Connectionist Temporal Classification modelParakeetTDTCTC- Hybrid TDT-CTC model
BaseParakeet and share the same core interface.Examples
Basic Usage
Loading with Custom Cache Directory
Loading from Local Directory
Using Different Precision
Type Casting for Variant-Specific Methods
Available Models
Popular Parakeet models on Hugging Face:mlx-community/parakeet-tdt-0.6b-v3- Latest TDT model, recommendedmlx-community/parakeet-tdt-1.1b- Larger TDT modelmlx-community/parakeet-rnnt-0.6b- RNNT variantmlx-community/parakeet-ctc-0.6b- CTC variantmlx-community/parakeet-tdt-ctc-0.6b- Hybrid TDT-CTC model
Implementation Details
The function:- Downloads
config.jsonandmodel.safetensorsfrom Hugging Face or reads from local directory - Detects model type based on config metadata:
- Checks
targetfield for model architecture - Checks
model_defaults.tdt_durationsto distinguish TDT from RNNT
- Checks
- Instantiates the appropriate model class
- Loads weights from safetensors file
- Casts weights to specified dtype
- Sets model to eval mode
Related
- BaseParakeet - Base class interface
- ParakeetTDT - TDT model specifics
- ParakeetRNNT - RNNT model specifics
- ParakeetCTC - CTC model specifics