Back to blog
GuidesWhistleFine-TuningSpeech RecognitionMultilingual

Fine-tuning Whistle

Teach Whistle a new language or your own vocabulary on your machine: the data, the commands, and what to expect.

JM

Jakub Mroz

3 min read

Whistle transcribes seven languages. cactus whistle finetune adapts it to your speakers and vocabulary, or teaches it a new language, on your own machine. cactus whistle build turns the result into a .cact that the same engine runs.

Install

pip install "cactus-compute[train]"

Data

Three JSONL files, for training, validation and test. Each line is one JSON object: a WAV file, its transcript and its language.

{"audio": "clips/0001.wav", "text": "Quero reservar uma mesa para dois.", "language": "pt"}
  • audio is relative to the JSONL file. WAV at any sample rate is resampled to 16 kHz, and other formats need pip install soundfile. Clips over 30 seconds, empty transcripts and transcripts over 320 tokens are skipped.
  • language is a language code. A code Whistle knows adapts that language, and any other code adds a new one. Lines without one take the code passed with --language.
  • Write the transcripts the way you want them back. The model learns the casing and punctuation of its training text.
  • To keep the other languages as they are, mix some of their clips into the training file.

New characters and words

Characters the tokenizer lacks, such as Portuguese ã and õ or any Cyrillic letter, are split into bytes. List the ones your language uses in tokens.txt, one per line, and pass it with --tokens. Each one becomes a single token with a new embedding row, trained alongside the adapters. Words work the same way, so the names and product terms your users say can go in the same file. The run prints how many of them appear in your transcripts and warns about any that did not become one piece. Leave language tags out of the file, since a new language gets its tag from the language codes in the data.

ã
õ
ç
â
ê

Train and build

cactus whistle finetune train.jsonl validation.jsonl test.jsonl --tokens tokens.txt --out adapter.safetensors
cactus whistle build --lora adapter.safetensors --out tuned.cact

The first run downloads the base checkpoint, checkpoints/whistle_cq4.safetensors. Training prints the training and validation loss after each epoch and ends with the word error rate on the test set. That number is a quick greedy decode on the 4-bit weights; for real-world numbers, build the .cact and transcribe the test set with it. It is scored after Whisper's text normaliser, so it ignores casing and punctuation, and it is a character error rate for scripts written without spaces.

The defaults are 3 epochs, batch 16 and learning rate 1e-4. Treat them as a starting point: try a few values of --epochs, --lr and --batch-size on your data, and keep the run with the lowest validation loss.

build merges the adapter and writes a .cact that carries your languages and tokens. It is about 29 MB, against 16.9 MB for the shipped model, because local fine-tuning exports at 4 bits instead of 2. --layers N writes a shallower decoder, any depth from 2 to 8, and --platform macos-arm64, or any other platform, also downloads that platform's engine and places the tuned file beside it as whistle.cact.

Run

import cactus

cactus.transcribe("clip.wav", weights="tuned.cact")

Streaming, keywords and word timestamps work as they do with the shipped model.

How much data

A new language has to learn its tag and its characters, so it needs more steps or a higher learning rate than adapting a language Whistle knows. Brazilian Portuguese from about ten hours of FLEURS, at --lr 1e-2 with the other defaults, went from 106.2% to 30.5% word error rate on FLEURS test and was detected as Portuguese on every test clip.

Two new languages in one run need enough data each before detection tells them apart. Scripts the base has never seen, such as Cyrillic, Arabic, Chinese, Japanese and Korean, need far more data before the text is usable.

Cite this post

@misc{mroz2026finetuning,
  title        = {Fine-tuning Whistle},
  author       = {Mroz, Jakub},
  year         = {2026},
  month        = oct,
  howpublished = {Cactus Compute blog},
  url          = {https://cactuscompute.com/blog/finetuning-whistle}
}