Skip to main content

An implementation of the Nvidia's Parakeet models for Apple Silicon using MLX.

Project description

Parakeet MLX

An implementation of the Parakeet models - Nvidia's ASR(Automatic Speech Recognition) models - for Apple Silicon using MLX.

Currently only for Parakeet TDT models. Support for additional Parakeet model variants is planned.

Installation

Using uv - recommended way:

uv add parakeet-mlx -U

Or, for the CLI:

uv tool install parakeet-mlx -U

Using pip:

pip install parakeet-mlx -U

CLI Quick Start

parakeet-mlx <audio_files> [OPTIONS]

Arguments

  • audio_files: One or more audio files to transcribe (WAV, MP3, etc.)

Options

  • --model (default: senstella/parakeet-tdt-0.6b-v2-mlx)

    • Hugging Face repository of the model to use
  • --output-dir (default: current directory)

    • Directory to save transcription outputs
  • --output-format (default: srt)

    • Output format (txt/srt/vtt/json/all)
  • --output-template (default: {filename})

    • Template for output filenames, {filename}, {index}, {date} is supported.
  • --highlight-words (default: False)

    • Enable word-level timestamps in SRT/VTT outputs
  • --verbose / -v (default: False)

    • Print detailed progress information
  • --fp32 / --bf16 (default: bf16)

    • Determinate the precision to use

Examples

# Basic transcription
parakeet-mlx audio.mp3

# Multiple files with word-level timestamps of VTT subtitle
parakeet-mlx *.mp3 --output-format vtt --highlight-words

# Generate all output formats
parakeet-mlx audio.mp3 --output-format all

Python API Quick Start

Transcribe a file:

from parakeet_mlx import from_pretrained

model = from_pretrained("senstella/parakeet-tdt-0.6b-v2-mlx")

result = model.transcribe("audio_file.wav")

print(result.text)

Check timestamps:

from parakeet_mlx import from_pretrained

model = from_pretrained("senstella/parakeet-tdt-0.6b-v2-mlx")

result = model.transcribe("audio_file.wav")

print(result.sentences)
# [AlignedSentence(text="Hello World.", start=1.01, end=2.04, duration=1.03, tokens=[...])]

Timestamp Result

  • AlignedResult: Top-level result containing the full text and sentences
    • text: Full transcribed text
    • sentences: List of AlignedSentence
  • AlignedSentence: Sentence-level alignments with start/end times
    • text: Sentence text
    • start: Start time in seconds
    • end: End time in seconds
    • duration: Between start and end.
    • tokens: List of AlignedToken
  • AlignedToken: Word/token-level alignments with precise timestamps
    • text: Token text
    • start: Start time in seconds
    • end: End time in seconds
    • duration: Between start and end.

Low-Level API

To transcribe log-mel spectrum directly, you can do the following:

import mlx.core as mx
from parakeet_mlx.audio import get_logmel, load_audio

# Load and preprocess audio manually
audio = load_audio("audio.wav", model.preprocessor_config.sample_rate)
mel = get_logmel(audio, model.preprocessor_config)

# Generate transcription with alignments
# Accepts both [batch, sequence, feat] and [sequence, feat]
# `alignments` is list of AlignedResult. (no matter you fed batch dimension or not!)
alignments = model.generate(mel)

Todo

  • Add CLI for better usability
  • Streaming input (Although RTFx is MUCH higher than 1 currently - it should be much sufficient to stream with current state)
  • Compiling for RNNT decoder
  • Add support for other Parakeet varients
  • Remove librosa dependency

Acknowledgments

  • Thanks to Nvidia for training this awesome models and writing cool papers and providing nice implementation.
  • Thanks to MLX project for providing the framework that made this implementation possible.
  • Thanks to audiofile and audresample, numpy, librosa for audio processing.
  • Thanks to dacite for config management.

License

Apache 2.0

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

parakeet_mlx-0.1.5.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parakeet_mlx-0.1.5-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file parakeet_mlx-0.1.5.tar.gz.

File metadata

  • Download URL: parakeet_mlx-0.1.5.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for parakeet_mlx-0.1.5.tar.gz
Algorithm Hash digest
SHA256 242b03c3b1bf007b0bb97da5df4b167a2bbf1f6678dd00108e91d61ebac93a1b
MD5 a7e5bdc79102eca6b71cf5558748f2c1
BLAKE2b-256 ef033c075fd17c7a1aca975b9539605784afee31c4504de4a975781ebe80ea67

See more details on using hashes here.

File details

Details for the file parakeet_mlx-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for parakeet_mlx-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0a8570230bbaf6f77bbb4b7c75dd31e1b4fd963febe99507c9626320ee7aff7f
MD5 1a40aa396c4193e0bf12cd798b8f7ed7
BLAKE2b-256 07e155c23a248626250f232c76688127583d077e85553c9cdb232d1e0108d113

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page