A streaming Darija speech recognizer for real-time voice agents: text as you speak, real time on cpu, strong on English, French, and MSA code switching

- Streaming, low latency: the first words appear 0.37 s after speech starts.
- Code-switching: transcribes Darija mixed with French, English and MSA. FLEURS WER: 10.4 French, 9.2 English, 10.1 Arabic.
- Real time on CPU: live text keeps up on 4 CPU cores (real-time factor 0.80).
Usage
The model runs in two modes:
| Mode | Chunk | Decoding | Use it for |
|---|---|---|---|
| Live | 320 ms | greedy | text while the speaker talks |
| Final | 1,120 ms | beam search (beam 8) | the most accurate text for each sentence |
pip install "nemo_toolkit[asr] @ git+https://github.com/NVIDIA-NeMo/NeMo.git@a2df7c12cf9c395cf64ec0bad9c6ec9189e53d0c"
import numpy as np, soundfile as sf, torch
import nemo.collections.asr as nemo_asr
from huggingface_hub import hf_hub_download
from nemo.collections.asr.parts.submodules.rnnt_decoding import RNNTDecodingConfig
from nemo.collections.asr.parts.utils.streaming_utils import CacheAwareStreamingAudioBuffer
model = nemo_asr.models.ASRModel.restore_from(
hf_hub_download("Tilas/nemotron-3.5-darija-v1.1", "step12000.nemo"), map_location="cuda").eval().float()
model.set_inference_prompt("ar-AR")
audio, sr = sf.read("clip.wav", dtype="float32") # 16 kHz mono
def decoding(strategy, beam=None):
cfg = RNNTDecodingConfig(fused_batch_size=-1); cfg.strategy = strategy
if beam: cfg.beam.beam_size = beam; cfg.beam.return_best_hypothesis = True
model.change_decoding_strategy(cfg); model.decoding.set_strip_lang_tags(True)
# Live: 320 ms chunks, greedy decoding, text after every chunk
model.encoder.set_default_att_context_size([56, 3])
decoding("greedy_batch")
buf = CacheAwareStreamingAudioBuffer(model=model, online_normalization=False, pad_and_drop_preencoded=False)
buf.append_audio(np.concatenate([audio, np.zeros(2 * sr, np.float32)]), stream_id=-1) # 2 s silence flushes the end
cache, hyps, preds = model.encoder.get_initial_cache_state(batch_size=1), None, None
for i, (chunk, length) in enumerate(buf):
with torch.inference_mode():
preds, texts, *cache, hyps = model.conformer_stream_step(
processed_signal=chunk.float(), processed_signal_length=length, cache_last_channel=cache[0],
cache_last_time=cache[1], cache_last_channel_len=cache[2], keep_all_outputs=buf.is_buffer_empty(),
previous_hypotheses=hyps, previous_pred_out=preds, return_transcription=True,
drop_extra_pre_encoded=0 if i == 0 else model.encoder.streaming_cfg.drop_extra_pre_encoded)
print(getattr(texts[0], "text", texts[0]))
# Final: 1,120 ms chunks, beam search (beam 8), one sentence at a time (split long recordings at pauses first)
model.encoder.set_default_att_context_size([56, 13])
decoding("malsd_batch", beam=8)
x = torch.from_numpy(np.concatenate([audio, np.zeros(2 * sr, np.float32)]))[None].cuda()
with torch.inference_mode():
enc, enc_len = model.forward(input_signal=x, input_signal_length=torch.tensor([x.shape[1]]).cuda(),
language_prompt_indices=torch.tensor([model.resolve_prompt_language("ar-AR")]).cuda())
print(model.decoding.rnnt_decoder_predictions_tensor(encoder_output=enc, encoded_lengths=enc_len)[0].text)
Where to use it
- Voice agents
- Call centres
- Live captioning
- Voice notes
- On-premise deployment
Results



Limitations
The model needs further optimization for your specific use case to meet the requirements of a production-grade deployment.
Licence
- The fine-tuning work is licensed under Apache-2.0.
- The model is built on NVIDIA's base model, whose parts remain under the OpenMDW-1.1 licence.
- Any redistribution must keep both licence files and the NOTICE.
Citation
If you use this model, please cite:
@misc{echchalim2026darija,
author = {Echchalim, Aymen},
title = {A Streaming Darija Speech Recognizer for Real-Time Voice Agents},
year = {2026},
howpublished = {\url{https://huggingface.co/Tilas/nemotron-3.5-darija-v1.1}}
}
Credits
- Base model: NVIDIA Nemotron 3.5 ASR Streaming 0.6B. Framework: NVIDIA NeMo.
- Evaluation:
- DarijaCS (Prism and Probe), Ministry of Artificial Intelligence, Digital Transformation and Administration Reform, Kingdom of Morocco; CC BY 4.0.
- Casablanca, Morocco subset; CC BY-NC-ND 4.0.
- FLEURS; CC BY 4.0.
Contact
Aymen Echchalim, huggingface.co/Tilas. Questions and issues: the Community tab of this repository.