- DictarisASR (formerly Turkish Whisper-Command ASR)
- Two training paths
- Command set
- Repository layout
- Data contract (command classifier)
- Training pipeline (command classifier — the deployment target)
- Common Voice baseline path (research comparison, not deployed)
- Acceptance threshold (command classifier)
- Third-party datasets and licenses
- Related repositories
- License
- Two training paths
DictarisASR (formerly Turkish Whisper-Command ASR)
Training pipeline for a small, offline Turkish speech command recognizer, meant to run fully disconnected on a microcontroller-class device. It was started as the planned voice input for the makeshift-flipper; that device is now a single ESP32-C6 with no microphone, so the target board for this model is not decided yet. The goal is not general speech-to-text — it's reliably classifying a short, fixed set of Turkish commands, including when they're whispered at very low volume. A separate research-baseline path (character-level CTC over Mozilla Common Voice) also lives here for comparison, but is explicitly not the deployment target — see Two training paths below.
This repository was split out of the makeshift-flipper firmware repo because it's a separate concern (Python/TensorFlow training vs. ESP-IDF C firmware) with its own, much larger and partly personal dataset.
Status: the command-classifier pipeline and its data contract are
defined and scripted; recording the actual command dataset and clearing
the accuracy gate (see below) has not happened yet. On the open-vocabulary
Turkish CTC baseline path, DictarisASR v2 Flagship (176.9 KB full-int8
1D-Conv bottleneck CTC with ReLU6 + 0-byte Intermediate CTC, stride=2,
same 130,499-param graph verified on a real ESP32-P4 at 630.46 ms
per 4 s audio, 6.34× real-time, 44.9 KB arena) is published on
Hugging Face alongside
DictarisASR v2 Slim (137.4 KB), DictarisASR Pico (84.7 KB), and the
legacy BiGRU v11 baseline (45.6% CER). v2 Flagship scores 28.42%
FP32 / 31.03% full-int8 greedy CER on FLEURS Turkish test (33.15% /
34.69% Common Voice, 34.60% / 37.21% MediaSpeech TR). See
Where the baseline stands.
Two training paths
train.py (command classifier) |
train_asr_common_voice.py / train_asr_smoke.py (CTC baseline) |
|
|---|---|---|
| Task | Fixed-label classification (12 labels, see commands.v1.json) |
Open-vocabulary character-level transcription |
| Deployment target | Yes — this is the model meant for the device | No — research baseline only, both scripts say so in their own docstrings |
| Input | 1-second 16kHz clips of the 12 known commands/wake word/unknown/silence | Common Voice or paired Wispr History audio+transcript |
| Split | Speaker-disjoint (same voice never in both train and validation) | Mozilla's official train/dev split, preserved as-is |
| Why it exists | The actual product feature | A sanity check on how far a from-scratch Turkish CTC model gets with public/personal data, useful context before trusting the classifier's numbers |
If you only care about the shipped feature, you want prepare_dataset.py →
train.py → export_tflite.py. The rest of this README covers both paths
since they share data-handling conventions.
Command set
Defined in commands.v1.json — keep the label order
fixed once a model is on a device, since the trained model's output index
order follows it:
unknown, silence, wake, menu_open, back, wifi_scan, wifi_monitor,
bluetooth_scan, rfid_read, ir_send, errors_show, cancel
wake = "hey flipper"; the rest map to specific makeshift-flipper menu
actions (see the phrases field in the JSON for the exact Turkish phrase
list per label). unknown and silence are mandatory negative classes —
without them the model can't tell "not a command" from "a command I don't
recognize."
Repository layout
voice/
├── scripts/
│ ├── prepare_dataset.py # validates voice/data/raw/, writes a manifest
│ ├── train.py # trains the command classifier (deployment target)
│ ├── export_tflite.py # float -> full-int8 .tflite
│ ├── train_asr_smoke.py # small CTC baseline smoke test
│ ├── train_asr_common_voice.py # full CTC baseline on Common Voice
│ ├── import_common_voice_scripted.py # Common Voice Scripted Speech -> manifest
│ ├── import_common_voice_spontaneous.py # Common Voice Spontaneous Speech -> manifest
│ ├── build_quality_common_voice.py # metadata-validated Common Voice subset
│ ├── export_wispr_pairs.py # exports paired Wispr Flow History rows (see below)
│ ├── inspect_wispr_schema.py # prints only schema/row counts, never transcripts
│ ├── inspect_wispr_history_stats.py # prints non-sensitive availability stats
│ ├── inspect_wispr_audio_format.py # identifies audio container metadata
│ └── finalize_common_voice.ps1
├── commands.v1.json # tracked: the versioned label/phrase set
├── QUALITY_RECORDING_PROTOCOL.md # tracked: the v2 controlled-recording protocol
├── data/ # NOT tracked: all raw/imported/derived audio
└── artifacts/ # NOT tracked: trained models
What's tracked in git and what isn't: only code and small config/docs
(commands.v1.json, the recording protocol) are tracked. All audio —
raw recordings, imported Common Voice clips, exported Wispr pairs, and
every trained model artifact — is gitignored. This is not just a size
concern: some of this data is personal voice recordings and must never be
published. Rebuild what you need locally with the commands below.
Data contract (command classifier)
voice/data/raw/<speaker>/<style>/<label>/<uuid>.wav
Example: voice/data/raw/erdem/whisper/wifi_scan/001.wav
- WAV, mono, 16-bit PCM, 16kHz.
- One command per recording, ~150ms of silence padding at start/end.
- At least 80 recordings per label per style, at least 8 distinct speakers.
whisper-style recordings: natural whisper, 15–40cm from the mic.unknown: Turkish speech the model should not match to any command.silence: ambient room noise. Both are required to keep false-trigger rate down.
For a more controlled, higher-quality v2 protocol (same mic across speakers, scripted sentences, explicit accept/reject criteria), see QUALITY_RECORDING_PROTOCOL.md — target: ≥12 speakers × 80 sentences × 2 reads (~1,920 recordings), 8/2/2 speaker split across train/dev/test so no speaker's voice crosses a split boundary.
Training pipeline (command classifier — the deployment target)
From this directory, Python 3.11:
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements-train.txt
python scripts\prepare_dataset.py # validates data/raw/, writes a manifest (no audio conversion)
python scripts\train.py # speaker-disjoint split, writes artifacts/
python scripts\export_tflite.py # float -> full-int8 .tflite
train.py performs a speaker-based split explicitly so the same person's
voice can never appear in both the training and evaluation sets — without
that, accuracy numbers would be inflated by the model partially recognizing
a specific voice rather than the command. Whisper-subset accuracy is
reported separately from normal-volume accuracy.
Common Voice baseline path (research comparison, not deployed)
# 1. Download & extract "Common Voice Spontaneous Speech -- Turkish" from
# the Mozilla Data Collective, then build a manifest from its TSV:
python scripts\import_common_voice_spontaneous.py <extracted-archive-dir>
# Or, for the Scripted Speech variant (keeps Mozilla's official train/dev/test split):
python scripts\import_common_voice_scripted.py <extracted-archive-dir>
# 2. Optional: a conservative, metadata-filtered subset (bad text, implausible
# duration/rate, duplicates, speaker overrepresentation -- not a noise judgment):
python scripts\build_quality_common_voice.py
# 3. Train the CTC baseline:
python scripts\train_asr_smoke.py # small/fast sanity check
python scripts\train_asr_common_voice.py # full run
python scripts\export_tflite.py
Keep the raw extracted archive under voice/data/source/ (gitignored, not
committed). The importer scripts only accept audio/text pairs resolvable by
an explicit filename column in the archive's metadata — they never guess a
pairing by timestamp or ordering.
Where the baseline stands
The current model is v11 (2026-10-25): 63,955 parameters, a 1-D convolution, a bidirectional GRU and a CTC character head over a 40-bin log-mel spectrogram. It is published as a legacy research baseline at inviolus/DictarisASR.
Measured on 500 held-out clips per test set with scripts/evaluate_asr.py
(greedy decoding, silence padding):
| Model | Test set | CER | WER |
|---|---|---|---|
| v9 | Common Voice scripted | 49.0% | 99.9% |
| v11 | Common Voice scripted | 45.6% | 102.0% |
| v9 | ISSAI test | 50.1% | 99.1% |
| v11 | ISSAI test | 46.3% | 101.5% |
Nearly half the characters are still wrong and almost no whole word is right (WER near 100%; above 100% means the model also inserts words). Example from the Common Voice test set: "ikincisiyse kredi toplamının yarısını karşılıyor" comes out as "irincisiyise kredi tokla mununyalısıya karşınıyor". This path remains a research baseline, not a deployable model.
v11's validation loss fell from 55.21 to 51.66 in 18 epochs and its best epoch was the last one, so it was still improving when the time ran out. Training loss stays well above validation loss: the network is underfitting. Its size, not the data, is the limit.
Version history
Each run continued from the previous run's weights. Runs before v6 used different validation subsets, so their losses are not comparable with the later ones; v6, v8, v9 and v11 share the same 3,000 dev clips.
| Run | Date | Training data | Epochs | Best validation loss | CER, Common Voice |
|---|---|---|---|---|---|
| Stage 2 | 2026-09-20 | 9,000 clips | 22 | 76.40 | 59.4% (older evaluator) |
| v3, v4 | 2026-09-20, 10-08 | up to 15,000 clips | 10, 3 | 64.46, 61.11 | n/m |
| v5 | 2026-10-09 | Common Voice, 50,000 clips | n/r | 58.58 | n/m |
| v6 | 2026-10-09 | Common Voice + ISSAI, 80,000 clips | 1 | 57.52 | n/m |
| v7 | 2026-10-10 | 41,338 clips | 5 | 60.36 | n/m |
| v8 | 2026-10-10 | Common Voice + ISSAI, 100,000 clips | 2 | 56.08 | n/m |
| v9 | 2026-10-10 | Common Voice + ISSAI, 60,000 clips | 5 | 55.27 | 49.0% |
| v10 | 2026-10 | stopped by hand after 1 epoch | 1 | 55.21 | n/m |
| v11 | 2026-10-25 | Common Voice + ISSAI, 100,000 clips | 18 | 51.66 | 45.6% |
| 2x width | 2026-11-07 | ASR_WIDTH=2, as a future teacher |
1 | 72.5 | stopped |
| pruned 0.75 | 2026-11-17 | v11 pruned to 38,375 parameters (scripts/prune_asr.py), then Common Voice + ISSAI + FLEURS tr ×4, 110,883 clips |
3 | 57.48 | 51.2% |
n/r: not recorded. n/m: not measured. v11 also moved to a shared front end
(scripts/asr_shared.py, scripts/text_norm.py) that pads with -80 dB
(silence) instead of 0. Clips whose transcript needs more CTC steps than the
audio provides (some ISSAI clips) are skipped, because they crash the CTC
loss.
2026-11-07: v11 underfits, so pruning it would make it worse. The script
now takes ASR_WIDTH (default 1, the unchanged v11 model) to build a wider
model as a teacher. A double-width run needed 143 minutes for one epoch on
the CPU next to two other trainings and was stopped; nothing from it is
published.
2026-11-17: the owner asked to prune the model anyway and train it on a new
dataset, as a measured experiment. scripts/prune_asr.py keeps the 75% most important
conv filters, GRU units and dense units by L1 weight (63,955 → 38,375 parameters,
40% fewer). It was trained for 3 epochs (about 4 CPU hours) on v11's data plus
FLEURS Turkish (CC BY 4.0, 2,526 training
clips repeated 4 times). Greedy CER on the same 500 clips per test set:
| Model | Parameters | Common Voice | ISSAI | FLEURS |
|---|---|---|---|---|
| v11 | 63,955 | 45.6% | 46.3% | 43.7% |
| pruned, before training | 38,375 | n/m | n/m | 85.7% |
| pruned 0.75, 3 epochs | 38,375 | 51.2% | 50.9% | 47.4% |
As expected for an underfitting model, the smaller one is 4-6 points worse; it was still improving (validation loss 59.7 → 57.9 → 57.5), but epochs slowed from 36 to 117 minutes on the shared CPU. Not published; v11 stays the baseline. The gap is smallest on FLEURS (3.7 points against 4.6 and 5.6), a small sign that the new data helped there.
DictarisASR v1.0 (Voice Hat A) — TFLite-Micro Conv1D CTC, ESP32-P4 Verified (2026-12-02 / 03)
To move past the BiGRU v11 bottleneck (45.6% CER) and make the model natively runnable on TFLite Micro without recurrent state ops, scripts/train_asr_conv1d_gpu.py trains a pure 1D-Conv + depthwise-separable Conv CTC network (C=96, stride=2, 176.8 KB full-int8, calibrated on real dev log-mel frames) on 95,000 commercial-clean Turkish clips (Common Voice CC0 + ISSAI MIT + FLEURS CC BY 4.0 + MediaSpeech TR CC BY 4.0).
Real ESP32-P4 (rev v1.3, 360 MHz, ESP-IDF 5.3.5 + esp-tflite-micro 1.4.2):
- File size:
176.8 KB(voice_c96_95k_ft_int8.tflite) - Arena RAM:
44.9 KB - Latency:
630.46 msper 4.0 s audio (6.34×faster than real-time; also verified running alongsideVoxHOD-Offshore Nano+Flâneurin a single312.5 KBfirmware)
Held-out Turkish Test Benchmarks (95k commercial-clean clips, stride=2, real-dev-mel full-int8):
| Model (published on HF) | Size (int8) | FLEURS FP32 / Int8 | Common Voice FP32 / Int8 | MediaSpeech TR FP32 / Int8 | Notes |
|---|---|---|---|---|---|
DictarisASR v2 Flagship (C=96 bottleneck, ReLU6 + 0-byte InterCTC 0.3 + --no-aug cooldown) |
176.9 KB |
28.42% / 31.03% |
33.15% / 34.69% |
34.60% / 37.21% |
New all-time champion (beats v1.0 on all 6 metrics with 0 B overhead) |
DictarisASR v2 Slim (C=80 bottleneck, ReLU6 + 0-byte InterCTC 0.3) |
137.4 KB |
30.82% / 33.07% |
35.81% / 37.16% |
37.15% / 39.71% |
Beats DW-Sep Slim (35.32%) by −2.25 pts at ~same size |
DictarisASR v1.0 (C=96 bottleneck, ReLU) |
176.8 KB |
28.74% / 31.72% |
34.09% / 36.35% |
34.94% / 38.21% |
Previous champion (tr_50k beam: 31.57%) |
DictarisASR Pico (C=64 DW-Sep + ReLU6) |
84.7 KB |
38.70% / 40.52% |
44.06% / 45.13% |
44.35% / 46.25% |
Sub-100 KB Turkish ASR (beats legacy v11 BiGRU 45.6% on CV!) |
- Stride ablation:
stride=4(40 ms/frame) collapses Turkish character CTC (48.88%dev CER) because fast Turkish syllables run out of CTC steps;stride=2(20 ms/frame) stays the default. - Bottleneck vs DW-Sep ablation (
2026-12-04 / 05): Standard dilated bottleneck (dwsep=0, 16ReLU6activations) consistently beats true single-pointwise DW-Sep (dwsep=1, 7ReLU6activations) by~2.2CER pts at equal KB budget (C=80137.4 KB33.07%vsC=96DW-Sep133.7 KB35.32%), while addingReLU6+ training-only0-byte InterCTC (0.3)+--no-auglow-LR cooldown improves both FP32 and full-int8 across every test set.
from huggingface_hub import hf_hub_download
cfg = hf_hub_download("inviolus/DictarisASR", "config.json")
model = hf_hub_download("inviolus/DictarisASR", "dictaris_v2_flagship_c96_int8.tflite")
Roadmap
Rule: the device model does not grow. A wider model may only serve as a teacher for a small one.
| Step | Why | Gate | Status |
|---|---|---|---|
| Move CTC baseline to GPU (WSL2) & TFLite-Micro Conv1D | v11 BiGRU was underfitting and too slow on CPU | CER below 40% on test sets, real MCU verification | done 2026-12-03: DictarisASR v1.0 (176.8 KB full-int8, 630.5 ms / 4 s on ESP32-P4) reaches 28.74% FP32 / 31.72% int8 on FLEURS TR and 34.09% FP32 on Common Voice |
| Train a wider teacher, distill into a tiny student | Push full-int8 FLEURS CER below 25% | Student beats c96_95k_ft at ≤180 KB |
planned |
| Record the command dataset and train the command classifier | That model, not this baseline, is the deployment target | The acceptance threshold below | open |
Wispr Flow History (personal data, opt-in, local-only)
export_wispr_pairs.py can pull paired WAV/transcript rows out of a local
Wispr Flow History SQLite database (opened
strictly read-only) as an additional personal-voice data source:
python scripts\inspect_wispr_schema.py <path-to-History.db> # schema + row counts only
python scripts\inspect_wispr_history_stats.py <path-to-History.db> # non-sensitive availability stats
python scripts\export_wispr_pairs.py <path-to-History.db> --output data\wispr
The inspect_* scripts deliberately print only schema/counts/format
metadata — never transcript content — so you can sanity-check a database
without a second script accidentally leaking its contents to a terminal
that might get pasted somewhere. export_wispr_pairs.py only emits rows
where the WAV blob and transcript come from the same History row (never
inferred by matching nearby timestamps). None of this is your data to run
against someone else's device — it's designed for exporting your own
local history.
Acceptance threshold (command classifier)
Before integration into any firmware, on a held-out set recorded by speakers not in training:
- Whisper command accuracy: ≥ 85%
- Normal-volume command accuracy: ≥ 92%
unknown/silencefalse-accept rate: ≤ 2%
A model that doesn't clear this bar does not get added to firmware. Open Turkish general-speech corpora (Common Voice) can help pretraining/ background diversity, but do not substitute for actual whispered recordings of the target commands — that's why the two paths in this repo stay separate.
Third-party datasets and licenses
None of this audio is redistributed in this repository; each source keeps its own license, and attribution is required where the license says so.
| Dataset | Role here | License | Source |
|---|---|---|---|
| Mozilla Common Voice, Turkish (Scripted and Spontaneous Speech) | CTC baseline training and evaluation | CC0 | Mozilla Data Collective |
| Multilingual Spoken Words Corpus (MSWC), Turkish | Candidate unknown class: 75,097 one-second clips of 2,965 words |
CC BY 4.0 | MLCommons/ml_spoken_words |
| Turkish Speech Command Dataset, Murat Kurtkaya (2021) | Candidate unknown class and command words: 26,484 one-second clips of 14 words, including "iptal" (1,952 clips, the cancel command itself), "geri" (1,880) and "aç" (1,955) |
CC BY-NC-SA 4.0 | Kaggle |
| FLEURS, Turkish (tr_tr), Google | CTC training & evaluation (DictarisASR v1.0) |
CC BY 4.0 | google/fleurs |
| MediaSpeech, Turkish (tr) | CTC training & out-of-domain evaluation (DictarisASR v1.0) |
CC BY 4.0 | OpenSLR 108 |
| ISSAI Turkish Speech Corpus | CTC training & candidate background speech: 218 hours | MIT | issai/Turkish_Speech_Corpus |
Common Voice and a subset of ISSAI (59,436 clips) have been used for the CTC baseline; MSWC and the Turkish Speech Command Dataset are downloaded locally as candidates for the command classifier. Apart from "iptal", none of them contains the command phrases themselves ("menü", "tara", "izle", "oku", "gönder" and "göster" do not occur in MSWC at all), and none contains whispered speech, so they do not replace recording the commands.
A model trained with the Turkish Speech Command Dataset would be bound by its non-commercial, share-alike terms; see MODEL_LICENSE.md.
Related repositories
- makeshift-flipper — the ESP32-C6 handheld firmware project this model was originally scoped for
- InviolusOCR — the sibling TinyML pipeline (offline Turkish line OCR), split out for the same reason (separate concern, separate dataset)
License
Code in this repository is released under the MIT License. Datasets are not part of the repository and keep their own licenses.
Trained model files are not covered by the MIT License; see MODEL_LICENSE.md and Third-party datasets and licenses.
- Downloads last month
- 263