ONNX export of
itzune/parakeet-tdt-0.6b-v3-basque packaged for
sherpa-onnx — a cross-platform, real-time speech recognition engine for edge devices, mobile, embedded systems, and WebAssembly.
WER measured on held-out test splits from
asierhv/composite_corpus_eu_v2.1:
Or download a pre-built binary / use the C++ API — see the
sherpa-onnx documentation.
1import sherpa_onnx
2
3# Point to the folder containing the 3 ONNX files + tokens.txt
4model_dir = "/path/to/parakeet-tdt-0.6b-v3-basque-sherpa-onnx"
5
6recognizer = sherpa_onnx.OfflineRecognizer.from_transducer(
7 encoder=f"{model_dir}/encoder.int8.onnx",
8 decoder=f"{model_dir}/decoder.int8.onnx",
9 joiner=f"{model_dir}/joiner.int8.onnx",
10 tokens=f"{model_dir}/tokens.txt",
11 num_threads=4,
12 decoding_method="greedy_search",
13 model_type="nemo_transducer",
14)
15
16# Transcribe a WAV file (16 kHz mono)
17stream = recognizer.create_stream()
18audio, sample_rate = sherpa_onnx.read_wave("/path/to/audio.wav")
19stream.accept_waveform(sample_rate, audio)
20recognizer.decode_stream(stream)
21print(stream.result.text)
1sherpa-onnx \
2 --encoder-model=encoder.int8.onnx \
3 --decoder-model=decoder.int8.onnx \
4 --joiner-model=joiner.int8.onnx \
5 --tokens=tokens.txt \
6 --decoding-method=greedy_search \
7 --model-type=nemo_transducer \
8 /path/to/audio.wav
1import sherpa_onnx
2import sounddevice as sd
3import numpy as np
4
5model_dir = "/path/to/parakeet-tdt-0.6b-v3-basque-sherpa-onnx"
6
7# For streaming/online, use OnlineRecognizer with the same model files
8# (sherpa-onnx supports NeMo TDT models both offline and online)
9recognizer = sherpa_onnx.OnlineRecognizer.from_transducer(
10 encoder=f"{model_dir}/encoder.int8.onnx",
11 decoder=f"{model_dir}/decoder.int8.onnx",
12 joiner=f"{model_dir}/joiner.int8.onnx",
13 tokens=f"{model_dir}/tokens.txt",
14 num_threads=4,
15 decoding_method="greedy_search",
16 model_type="nemo_transducer",
17 chunk_size=32,
18)
19
20stream = recognizer.create_stream()
21sample_rate = 16000
22
23def callback(indata, frames, time, status):
24 samples = indata[:, 0].astype(np.float32)
25 stream.accept_waveform(sample_rate, samples)
26 while recognizer.is_ready(stream):
27 recognizer.decode_stream(stream)
28 result = recognizer.get_result(stream)
29 if result:
30 print(f"\r{result}", end="", flush=True)
31
32with sd.InputStream(samplerate=sample_rate, channels=1, callback=callback):
33 print("Listening... Press Ctrl+C to stop.")
34 import time
35 while True:
36 time.sleep(0.1)
This model was exported from the
.nemo checkpoint using a custom script based on the
official sherpa-onnx export guide for Parakeet TDT:
The export and fine-tuning code is available at:
xezpeleta/parakeet-tdt-0.6b-v3-basque.
CC BY 4.0. Inherit license obligations from the base model and dataset.