Automatic Speech Recognition
Transformers
ONNX
Safetensors
Transformers.js
Turkish
moonshine
speech
turkish
webgpu
wasm
edge
browser
Instructions to use ekremcet/moonshine-tiny-tr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ekremcet/moonshine-tiny-tr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="ekremcet/moonshine-tiny-tr")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("ekremcet/moonshine-tiny-tr") model = AutoModelForSpeechSeq2Seq.from_pretrained("ekremcet/moonshine-tiny-tr", device_map="auto") - Transformers.js
How to use ekremcet/moonshine-tiny-tr with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('automatic-speech-recognition', 'ekremcet/moonshine-tiny-tr'); - Notebooks
- Google Colab
- Kaggle
Moonshine Tiny TR (ekremcet/moonshine-tiny-tr)
A compact, browser-ready Turkish Automatic Speech Recognition (ASR) model built on the Moonshine encoder-decoder architecture (MoonshineForConditionalGeneration), distilled and optimized specifically for punctuated, capitalized Turkish speech.
- 20.0M parameters (
d_model=288, 6 encoder / 6 decoder layers, 8 attention heads) 21.45 MBtotal INT8 ONNX (8.05 MBencoder +13.40 MBmerged decoder) — runs 40×–90× faster than real time on CPU (RTF = 0.011–0.025) and natively in the browser via@huggingface/transformers(WebGPU & WASM)- Variable-length raw 16 kHz audio input (no fixed 30-second Whisper padding overhead)
- Custom 8,192-vocab Turkish BPE tokenizer (
1.9×–2.15×fewer tokens per Turkish sentence than English Moonshine, with full support forç ğ ı İ ö ş ü, apostrophes, and punctuation) - Full PyTorch + ONNX distribution: Works out of the box with both Python
transformers(model.safetensors) and browser/edgeTransformers.js(onnx/)
Benchmark Results (Sealed Turkish Test Sets)
Evaluated across four held-out Turkish benchmarks (0 utterance overlap with training data). Normalized WER/CER applies Turkish-aware lowercasing (İ→i, I→ı) and strips punctuation; Raw WER/CER preserves exact capitalization, apostrophes, and punctuation.
| Sealed Test Split | Clips | Beam-4 Norm WER | Beam-4 Norm CER | Greedy Norm WER | Greedy Norm CER | Beam-4 Raw WER |
|---|---|---|---|---|---|---|
| FLEURS-TR test | 743 | 17.66% | 5.20% | 20.39% | 6.13% | 25.83% |
| Common Voice 27 TR test | 833 | 16.68% | 4.76% | 20.72% | 6.34% | 22.40% |
| MediaSpeech-TR test (TV broadcast) | 251 | 19.63% | 6.70% | 22.86% | 8.00% | 20.48% |
| ISSAI Turkish test | 796 | 18.65% | 6.14% | 22.13% | 7.61% | 18.85% |
- CPU INT8 ONNX speed:
~90–200 msend-to-end on an8.16 sTurkish clip (RTF = 0.011–0.025, 40×–90× real time). - Exact parity: FP32 ONNX matches PyTorch greedy decoding token-for-token.
Usage in the Browser (@huggingface/transformers)
import { pipeline } from "@huggingface/transformers";
const transcriber = await pipeline(
"automatic-speech-recognition",
"ekremcet/moonshine-tiny-tr",
{
dtype: {
encoder_model: "q8",
decoder_model_merged: "q8",
},
device: "wasm", // or "webgpu"
}
);
// audio: Float32Array at 16 kHz mono (or audio URL)
const output = await transcriber(audio);
console.log(output.text);
Usage in Python (transformers)
import soundfile as sf
import torch
from transformers import MoonshineForConditionalGeneration, PreTrainedTokenizerFast
MODEL_ID = "ekremcet/moonshine-tiny-tr"
tokenizer = PreTrainedTokenizerFast.from_pretrained(MODEL_ID)
model = MoonshineForConditionalGeneration.from_pretrained(MODEL_ID).eval()
wav, sr = sf.read("sample_16k.wav", dtype="float32")
if wav.ndim > 1:
wav = wav.mean(axis=-1)
with torch.no_grad():
ids = model.generate(
input_values=torch.from_numpy(wav).unsqueeze(0),
max_new_tokens=180,
num_beams=4,
repetition_penalty=1.05,
no_repeat_ngram_size=5,
)
print(tokenizer.decode(ids[0], skip_special_tokens=True))
Model Files
onnx/encoder_model_quantized.onnx/onnx/encoder_model_int8.onnx(8.05 MB) — INT8/UINT8 quantized raw-waveform encoderonnx/decoder_model_merged_quantized.onnx/onnx/decoder_model_merged_int8.onnx(13.40 MB) — INT8/UINT8 quantized merged KV-cache decoderonnx/encoder_model.onnx(31 MB) &onnx/decoder_model_merged.onnx(49 MB) — FP32 ONNX weightsmodel.safetensors(77 MB) — FP32 PyTorch weights
Training & Distillation Summary
- Initialization: Pretrained acoustic front-end (
conv1–conv3+ 6 encoder layers) and 6 decoder transformer blocks transferred fromUsefulSensors/moonshine-tiny, paired with a newly trained 8,192-vocab Turkish BPE tokenizer (max_position_embeddings=512). - Data & Distillation: Trained on a balanced real-first corpus of open and synthetic Turkish speech (
Common Voice 27 TR,YODAS2 TR,Khan Academy TR,FLEURS-TR train,Alania CC-BY, synthetic Turkish digits/names, plus agreement-gated Whisper-Large teacher-distilled punctuation labels onISSAIandMediaSpeechtrain splits) with speed perturbation (0.9×–1.1×), narrowband 8 kHz microphone/codec simulation, background noise mixing (SNR 6–28 dB), gain jitter, and waveform time-masking, finalized via multi-checkpoint weight averaging. - License: MIT (matching
UsefulSensors/moonshine-tiny).
- Downloads last month
- -
Model tree for ekremcet/moonshine-tiny-tr
Base model
moonshine-ai/moonshine-tiny