Model reference · open weights
asr-streaming-conformer-gigaspeech is an open-weight audio or speech model from speechbrain. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Maker | speechbrain |
|---|---|
| Type | Audio & music |
| Task | Speech→text |
| Runs with | speechbrain |
| Released | 2024-11-06 |
| Popularity | 26 downloads / month |
| Licence | Open weights |
About
This repository provides all the necessary tools to perform automatic speech recognition from an end-to-end system pretrained on GigaSpeech (EN, XL split) within SpeechBrain. For a better experience, we encourage you to learn more about SpeechBrain. The performance of the model in full context mode (no streaming) is the following:
| Release | Test WER | GPUs |
|---|---|---|
| 2024-11-08 | 11.00% | 4xA100 40GB |
With streaming, the results with different chunk sizes on the test split are the following:
| full | cs=32 (1280ms) | 24 (960ms) | 16 (640ms) | 12 (480ms) | 8 (320ms) | |
|---|---|---|---|---|---|---|
| full | 11.00% | - | - | - | - | - |
| 16 | - | - | - | 11.70% | 11.84% | 12.14% |
| 8 | - | - | 11.50% | 11.72% | 11.88% | 12.28% |
| 4 | - | 11.40% | 11.53% | 11.81% | 12.03% | 12.64% |
| 2 | - | 11.46% | 11.67% | 12.03% | 12.43% | 13.25% |
| 1* | - | 11.59% | 11.85% | 12.39% | 12.93% | 14.13% |
(*: model was never explicitly trained with this setting)
When comparing configurations, bear in mind that the utterances of the test set are of a finite length. All WER values were evaluated using this script (until we integrate a nicer way to evaluate streaming WER in different conditions).
This ASR system is a Conformer model trained with the RNN-T loss (with an auxiliary CTC loss to stabilize training). The model operates with a unigram tokenizer. Architecture details are described in the training hyperparameters file.
Streaming support makes use of Dynamic Chunk Training. Chunked attention is used for the multi-head attention module, and an implementation of Dynamic Chunk Convolutions was used. The model was trained with support for different chunk sizes (and even full context), and so is suitable for various chunk sizes and offline transcription.
The system is trained with recordings sampled at 16kHz (single channel).
The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling transcribe_file if needed.
First of all, please install SpeechBrain with the following command:
pip install speechbrain
Please notice that we encourage you to read our tutorials and learn more about SpeechBrain.
from speechbrain.inference.ASR import StreamingASR
from speechbrain.utils.dynamic_chunk_training import DynChunkTrainConfig
asr_model = StreamingASR.from_hparams("speechbrain/asr-streaming-conformer-gigaspeech")
asr_model.transcribe_file(
"speechbrain/asr-streaming-conformer-librispeech/test-en.wav",
# select a chunk size of ~960ms with 4 chunks of left context
DynChunkTrainConfig(24, 4),
# disable torchaudio streaming to allow fetching from HuggingFace
# set this to True for your own files or streams to allow for streaming file decoding
use_torchaudio_streaming=False,
)
The DynChunkTrainConfig values can be adjusted for a tradeoff of latency, computational power and transcription accuracy. Refer to the streaming WER table to pick a value that is suitable for your usecase.
Decoding from a live stream using ffmpeg (BBC Radio 4):
python3 asr.py http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_fourfm/bbc_radio_fourfm.isml/bbc_radio_fourfm-audio%3d96000.norewind.m3u8 --model-source=speechbrain/asr-streaming-conformer-gigaspeech --device=cpu -v
Decoding from a file:
python3 asr.py some-english-speech.wav --model-source=speechbrain/asr-streaming-conformer-gigaspeech --device=cpu -v
from argparse import ArgumentParser
import logging
parser = ArgumentParser()
parser.add_argument("audio_path")
parser.add_argument("--model-source", required=True)
parser.add_argument("--device", default="cpu")
parser.add_argument("--ip", default="127.0.0.1")
parser.add_argument("--port", default=9431)
parser.add_argument("--chunk-size", default=24, type=int)
parser.add_argument("--left-context-chunks", default=4, type=int)
parser.add_argument("--num-threads", default=None, type=int)
parser.add_argument("--verbose", "-v", default=False, action="store_true")
args = parser.parse_args()
if args.verbose:
logging.getLogger().setLevel(logging.INFO)
logging.info("Loading libraries")
from speechbrain.inference.ASR import StreamingASR
from speechbrain.utils.dynamic_chunk_training import DynChunkTrainConfig
import torch
device = args.device
if args.num_threads is not None:
torch.set_num_threads(args.num_threads)
logging.info(f"Loading model from \"{args.model_source}\" onto device {device}")
asr = StreamingASR.from_hparams(args.model_source, run_opts={"device": device})
config = DynChunkTrainConfig(args.chunk_size, args.left_context_chunks)
logging.info(f"Starting stream from URI \"{args.audio_path}\"")
for text_chunk in asr.transcribe_file_streaming(args.audio_path, config):
print(text_chunk, flush=True, end="")
We want to optimize some things around the model before we create a proper HuggingFace space demonstrating live streaming on CPU.
In the mean time, this is a simple hacky demo of live ASR in the browser using Gradio's live microphone streaming feature.
If you run this, please note:
From the published model card. Full card on the HuggingFace links in the sidebar.
How it works
Benchmarks
As published on the model card — the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| Automatic Speech Recognition | GigaSpeech | Test WER (non-streaming greedy) | |
| Automatic Speech Recognition | GigaSpeech | Test WER (960ms chunk size, 4 left context chunks) |
Using it via the API
Once AxForge deploys asr-streaming-conformer-gigaspeech for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (asr-streaming-conformer-gigaspeech below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/audio/transcriptions \ -H "Authorization: Bearer $AXFORGE_API_KEY" \ -F model="asr-streaming-conformer-gigaspeech" -F file=@audio.mp3
Create an account — your API key is available in the console. 5M tokens/month currently included with every new account at launch.