đ Canary 1B
NVIDIA NeMo Canary is a family of multi - lingual multi - tasking models that achieve state - of - the - art performance on multiple benchmarks. With 1 billion parameters, Canary - 1B supports automatic speech - to - text recognition (ASR) in 4 languages (English, German, French, Spanish) and translation from English to German/French/Spanish and from German/French/Spanish to English with or without punctuation and capitalization (PnC).
Key Information Table
Property |
Details |
Model Type |
Encoder - Decoder with FastConformer encoder and Transformer Decoder |
Training Data |
85k hrs of speech data, including 31k hrs of public data, 20k hrs collected by Suno, and 34k hrs of in - house data |
Supported Languages |
English, German, French, Spanish |
Tasks |
Automatic Speech Recognition, Automatic Speech Translation |
Tags |
automatic - speech - recognition, automatic - speech - translation, speech, audio, Transformer, FastConformer, Conformer, pytorch, NeMo, hf - asr - leaderboard |
Model Badges
|
| 
â ī¸ Important Note
Checkout our latest Canary - 1B - Flash model, a faster and more accurate variant of Canary - 1B!
đ Quick Start
To start using the Canary - 1B model, first, you need to install NVIDIA NeMo. It's recommended to install it after installing Cython and the latest PyTorch version.
pip install git+https://github.com/NVIDIA/NeMo.git@r1.23.0#egg=nemo_toolkit[asr]
⨠Features
- Multi - lingual Support: Supports ASR and speech translation in English, German, French, and Spanish.
- Multi - tasking: Capable of both automatic speech recognition and automatic speech translation.
- State - of - the - art Performance: Achieves excellent results on multiple benchmarks.
đĻ Installation
pip install git+https://github.com/NVIDIA/NeMo.git@r1.23.0#egg=nemo_toolkit[asr]
đģ Usage Examples
Basic Usage
from nemo.collections.asr.models import EncDecMultiTaskModel
canary_model = EncDecMultiTaskModel.from_pretrained('nvidia/canary-1b')
decode_cfg = canary_model.cfg.decoding
decode_cfg.beam.beam_size = 1
canary_model.change_decoding_strategy(decode_cfg)
Advanced Usage
Loading the Model
from nemo.collections.asr.models import EncDecMultiTaskModel
canary_model = EncDecMultiTaskModel.from_pretrained('nvidia/canary-1b')
decode_cfg = canary_model.cfg.decoding
decode_cfg.beam.beam_size = 1
canary_model.change_decoding_strategy(decode_cfg)
Input as a List of Audio File Paths
predicted_text = canary_model.transcribe(
paths2audio_files=['path1.wav', 'path2.wav'],
batch_size=16,
)[0].text
Input as a JSONL Manifest File
{
"audio_filepath": "/path/to/audio.wav",
"duration": 1000,
"taskname": "asr",
"source_lang": "en",
"target_lang": "en",
"pnc": "yes",
"answer": "na",
}
predicted_text = canary_model.transcribe(
"<path to input manifest file>",
batch_size=16,
)[0].text
Using transcribe_speech.py
Script
python [NEMO_GIT_FOLDER]/examples/asr/transcribe_speech.py
pretrained_name="nvidia/canary-1b"
audio_dir="<path to audio_directory>"
python [NEMO_GIT_FOLDER]/examples/asr/transcribe_speech.py
pretrained_name="nvidia/canary-1b"
dataset_manifest="<path to manifest file>"
đ Documentation
Model Architecture
Canary is an encoder - decoder model with FastConformer [1] encoder and Transformer Decoder [2]. With audio features extracted from the encoder, task tokens such as <source language>
, <target language>
, <task>
and <toggle PnC>
are fed into the Transformer Decoder to trigger the text generation process. Canary uses a concatenated tokenizer [5] from individual SentencePiece [3] tokenizers of each language, which makes it easy to scale up to more languages. The Canay - 1B model has 24 encoder layers and 24 layers of decoder layers in total.
Training
Canary - 1B is trained using the NVIDIA NeMo toolkit [4] for 150k steps with dynamic bucketing and a batch duration of 360s per GPU on 128 NVIDIA A100 80GB GPUs. The model can be trained using this example script and [base config](https://github.com/NVIDIA/NeMo/blob/main/examples/asr/conf/speech_multitask/fast - conformer_aed.yaml). The tokenizers for these models were built using the text transcripts of the train set with this script.
Datasets
The Canary - 1B model is trained on a total of 85k hrs of speech data. It consists of 31k hrs of public data, 20k hrs collected by Suno, and 34k hrs of in - house data.
English (25.5k hours)
- Librispeech 960 hours
- Fisher Corpus
- Switchboard - 1 Dataset
- WSJ - 0 and WSJ - 1
- National Speech Corpus (Part 1, Part 6)
- VCTK
- VoxPopuli (EN)
- Europarl - ASR (EN)
- Multilingual Librispeech (MLS EN) - 2,000 hour subset
- Mozilla Common Voice (v7.0)
- People's Speech - 12,000 hour subset
- Mozilla Common Voice (v11.0) - 1,474 hour subset
German (2.5k hours)
- Mozilla Common Voice (v12.0) - 800 hour subset
- Multilingual Librispeech (MLS DE) - 1,500 hour subset
- VoxPopuli (DE) - 200 hr subset
Spanish (1.4k hours)
- Mozilla Common Voice (v12.0) - 395 hour subset
- Multilingual Librispeech (MLS ES) - 780 hour subset
- VoxPopuli (ES) - 108 hour subset
- Fisher - 141 hour subset
French (1.8k hours)
- Mozilla Common Voice (v12.0) - 708 hour subset
- Multilingual Librispeech (MLS FR) - 926 hour subset
- VoxPopuli (FR) - 165 hour subset
Performance
ASR Performance (w/o PnC)
The ASR performance is measured with word error rate (WER), and we process the groundtruth and predicted text with [whisper - normalizer](https://pypi.org/project/whisper - normalizer/).
WER on MCV - 16.1 test set:
Version |
Model |
En |
De |
Es |
Fr |
1.23.0 |
canary - 1b |
7.97 |
4.61 |
3.99 |
6.53 |
WER on MLS test set:
Version |
Model |
En |
De |
Es |
Fr |
1.23.0 |
canary - 1b |
3.06 |
4.19 |
3.15 |
4.12 |
More details on evaluation can be found at [HuggingFace ASR Leaderboard](https://huggingface.co/spaces/hf - audio/open_asr_leaderboard)
AST Performance
We evaluate AST performance with BLEU score, and use native annotations with punctuation and capitalization in the datasets.
BLEU score on FLEURS test set:
Version |
Model |
En->De |
En->Es |
En->Fr |
De->En |
Es->En |
Fr->En |
1.23.0 |
canary - 1b |
32.15 |
22.66 |
40.76 |
33.98 |
21.80 |
30.95 |
BLEU score on COVOST - v2 test set:
Version |
Model |
De->En |
Es->En |
Fr->En |
1.23.0 |
canary - 1b |
37.67 |
40.7 |
40.42 |
BLEU score on [mExpresso](https://huggingface.co/facebook/seamless - expressive#mexpresso - multilingual - expresso) test set:
Version |
Model |
En->De |
En->Es |
En->Fr |
1.23.0 |
canary - 1b |
23.84 |
35.74 |
28.29 |
Model Fairness Evaluation
As outlined in the paper "Towards Measuring Fairness in AI: the Casual Conversations Dataset", we assessed the Canary - 1B model for fairness. The model was evaluated on the CausalConversations - v1 dataset, and the results are reported as follows:
Gender Bias:
Gender |
Male |
Female |
N/A |
Other |
Num utterances |
19325 |
24532 |
926 |
33 |
% WER |
14.64 |
12.92 |
17.88 |
126.92 |
Age Bias:
Age Group |
(18 - 30) |
(31 - 45) |
(46 - 85) |
(1 - 100) |
Num utterances |
15956 |
14585 |
13349 |
43890 |
% WER |
14.64 |
13.07 |
13.47 |
13.76 |
(Error rates for fairness evaluation are determined by normalizing both the reference and predicted text, similar to the methods used in the evaluations found at https://github.com/huggingface/open_asr_leaderboard.)
NVIDIA Riva: Deployment
NVIDIA Riva, is an accelerated speech AI SDK deployable on - prem, in all clouds, multi - cloud, hybrid, on edge, and embedded. Additionally, Riva provides:
- World - class out - of - the - box accuracy for the most common languages with model checkpoints trained on proprietary data with hundreds of thousands of GPU - compute hours
- Best in class accuracy with run - time word boosting (e.g., brand and product names) and customization of acoustic model, language model, and inverse text normalization
- Streaming speech recognition, Kubernetes compatible scaling, and enterprise - grade support
Canary is available as a NIM endpoint via Riva. Try the model yourself here: [https://build.nvidia.com/nvidia/canary - 1b - asr](https://build.nvidia.com/nvidia/canary - 1b - asr).
đ§ Technical Details
The Canary - 1B model uses a FastConformer encoder and a Transformer decoder. The encoder extracts audio features, and task tokens are then fed into the decoder to generate text. The concatenated tokenizer from individual SentencePiece tokenizers makes it easy to scale to more languages. The model has 24 encoder layers and 24 decoder layers.
đ License
License to use this model is covered by the [CC - BY - NC - 4.0](https://creativecommons.org/licenses/by - nc/4.0/deed.en#:~:text=NonCommercial%20%E2%80%94%20You%20may%20not%20use,doing%20anything%20the%20license%20permits.). By downloading the public and release version of the model, you accept the terms and conditions of the CC - BY - NC - 4.0 license.
References
[1] Fast Conformer with Linearly Scalable Attention for Efficient Speech Recognition
[2] Attention is all you need
[3] Google Sentencepiece Tokenizer
[4] NVIDIA NeMo Toolkit
[5] [Unified Model for Code - Switching Speech Recognition and Language Identification Based on Concatenated Tokenizer](https://aclanthology.org/2023.calcs - 1.7.pdf)