Lightweight, low-latency Turkish speech models for real-time applications.
Seda aims to provide models that are small enough to run on a CPU, fast enough for live audio, accurate enough for production, and available for commercial use. sedalib is the Python package for running them. It currently ships streaming speech recognition (STT) on top of sherpa-onnx.
Models
| Model | Task | Architecture | Params | FLEURS-TR test WER |
|---|---|---|---|---|
| seda-v0.2 | Streaming STT | Zipformer2 transducer + second pass | 66.1M | 6.38 (accurate), 7.26 (balanced) |
| seda-v0.1 | Streaming STT | Zipformer2 transducer | 66.1M | 11.60 |
For comparison, Whisper medium scores 6.62 and Whisper large-v3 4.62 on the same set. See the model card for noisy, telephone and broadcast audio.
Installation
pip install sedalib
pip install "sedalib[format]" # adds digits, punctuation and casing to the output
Python 3.10 or newer is required. The core package depends only on sherpa-onnx and huggingface-hub.
Quick start
Transcribe a complete waveform. read_wav loads a 16-bit PCM WAV file as mono float samples in [-1, 1] together with its sample rate:
from sedalib import Recognizer, read_wav
samples, sample_rate = read_wav("audio.wav")
recognizer = Recognizer.from_pretrained() # downloads the model once and caches it
text = recognizer.transcribe(samples, sample_rate)
print(text)
Audio at other sample rates is resampled automatically.
Streaming
For live audio, open a stream and feed it small pieces as they arrive. accept returns the current partial transcript, and is_endpoint turns true when the speaker pauses. end_utterance returns the final text and starts the next utterance.
stream = recognizer.stream()
for chunk in microphone_chunks(): # e.g. 100 ms of audio at a time
partial = stream.accept(chunk, sample_rate=16000)
print(partial)
if stream.is_endpoint:
print("final:", stream.end_utterance())
The end of speech is detected by Silero VAD after a 0.25 s pause (endpoint_silence). If your application already knows that the speaker stopped, for example with a push-to-talk button, call end_utterance() right away.
To keep accepting audio while the final text is computed, split the two steps: stream.cut() ends the utterance and returns it, and utterance.finalize() can run in another thread.
A single Recognizer can serve many streams at once, from different threads. Call stream.finish() at the end of the audio to flush the remaining frames and get the final text.
Modes
| Mode | Live text | Final text | WER | Final text after a pause | RTF |
|---|---|---|---|---|---|
fast |
0.64 s chunks, greedy | the same | 9.38 | 0.32 s | 0.042 |
balanced (default) |
1.28 s chunks, beam search + LM | the same | 7.26 | 0.37 s | 0.064 |
accurate |
0.64 s chunks, greedy | second pass with full context, beam search + LM | 6.38 | 0.77 s | 0.137 |
- WER: FLEURS-TR test.
- Final text after a pause: median time from the end of speech, including the 0.25 s pause the VAD waits for.
- Speed: RTF on one thread of an Intel Core 5 210H CPU, including the second pass.
The second pass of accurate runs in the background while the utterance is spoken, so most of its work is done when the speaker stops.
Options
Recognizer.from_pretrained(
"atasoglu/seda-v0.2", # Hugging Face repo id
revision=None, # pin a branch, tag or commit
mode="balanced", # "fast", "balanced" or "accurate"
use_lm=None, # override the mode: rescore with the language model
two_pass=None, # override the mode: decode each utterance again for the final text
chunk=None, # override the mode: 32 or 64 frames (0.64 or 1.28 s per streaming step)
punctuate=False, # digits, punctuation, casing and apostrophes in final texts (needs [format])
num_threads=1, # CPU threads per model
vad=None, # Silero VAD for the end of speech (default: if the model ships it)
endpoint_silence=None, # pause that ends an utterance, in s (default 0.25 with the VAD, 1.2 without)
)
from_pretrained downloads only the files the chosen options need. To load a model you have already downloaded, use Recognizer("path/to/model_dir").
- Faster end of speech: a shorter pause gives the final text sooner, but splits sentences more often at short hesitations. With 0.15 s, the final text arrives after about 0.22 s (
fast) and 0.27 s (balanced). - Threads:
num_threads=2makesfastandbalancedabout 15% faster. More threads do not help a single stream. To serve many users, give each stream one thread and run them in parallel: one recognizer scales to about 4× the throughput on 8 cores. - Formatter:
punctuate=Truewrites "Bugün Ankara'da hava 24 derece" instead of "bugün ankarada hava yirmi dört derece".sedalib.itnconverts only the numbers and needs no extra. - seda-v0.1: works with the
balancedmode, with or withoutuse_lm, and ends utterances with the 1.2 s silence rule. It does not have the files forfast,accurate, the VAD or the formatter.
Demo
A Gradio demo with live microphone streaming, file transcription, a control panel for all options and latency stats is available as an extra:
pip install "sedalib[demo]"
python -m sedalib.demo.stt
Development
uv sync --all-extras
uv run prek install # ruff lint and format hooks
uv run pytest # tests that need a model are skipped
SEDA_TEST_MODEL=atasoglu/seda-v0.2,atasoglu/seda-v0.1 uv run pytest # with models
License
The code is released under Apache-2.0. The seda-v0.2 model files are CC BY-SA 4.0, because parts of their training data are share-alike: Khan Academy for the acoustic model, and Wikipedia for the language model and the formatter. The Silero VAD file shipped with the model is MIT. Commercial use is allowed under these terms; see the model cards for details.
Metadata
Release files for sedalib 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sedalib-1.0.0.tar.gz | 372.4 kB | Without provenance | Details for sedalib-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sedalib-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sedalib-1.0.0-py3-none-any.whl |
Total release size: 399.8 kB
Release files / sedalib-1.0.0.tar.gz
| Download URL | sedalib-1.0.0.tar.gz |
|---|---|
| Size | 372.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cada1387dbd9bb6c8815a48d9e1bc7a1303131bc79527e60b5417d5c521a9c11
|
|
BLAKE2b-256 checksum How to use checksums |
783dadf31aa36fc06cb182c6598f8e6faf812961db9f2a4f9f88b9affd8b3813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sedalib-1.0.0-py3-none-any.whl
| Download URL | sedalib-1.0.0-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ad14f8e28548c9b990278fe8d5e916a13a124fca901540b6bdc2a5ed4527666
|
|
BLAKE2b-256 checksum How to use checksums |
9a1a3eba1058d9a77e59189682ae1038e625793d8fa6f947c2c89b84ce59141d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for sedalib 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.