Commit
·
770a734
1
Parent(s):
370f6f5
Revert "Upload folder using huggingface_hub"
Browse filesThis reverts commit 370f6f5b9c9e7921649309b38dab0c563bfd4dd5.
- .gitattributes +1 -0
- README.md +252 -13
- app.py +0 -120
- packages.txt +0 -2
- pre-requirements.txt +0 -1
- requirements.txt +0 -3
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
results_hf/open-asr-leaderboarddatasets-test-only-spgispeech-test.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,13 +1,252 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Model Overview
|
2 |
+
|
3 |
+
## Description:
|
4 |
+
NVIDIA NeMo Canary-Qwen-2.5B is an English speech recognition model that achieves state-of-the art performance on multiple English speech benchmarks. With 2.5 billion parameters and running at 458 RTFx, Canary-Qwen-2.5B supports automatic speech-to-text recognition (ASR) in English with punctuation and capitalization (PnC). The model is intended as a transcription tool only, and not expected to extend the LLM capabilities into speech modality. This model is ready for commercial use.
|
5 |
+
|
6 |
+
### License/Terms of Use:
|
7 |
+
Canary-Qwen-2.5B is released under the CC-BY-4.0 license. By using this model, you are agreeing to the [terms and conditions](https://choosealicense.com/licenses/cc-by-4.0/) of the license. <br>
|
8 |
+
|
9 |
+
## References:
|
10 |
+
[1] [Less is More: Accurate Speech Recognition & Translation without Web-Scale Data](https://www.isca-archive.org/interspeech_2024/puvvada24_interspeech.pdf)
|
11 |
+
|
12 |
+
[2] [Fast Conformer with Linearly Scalable Attention for Efficient Speech Recognition](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=10389701)
|
13 |
+
|
14 |
+
[3] [Attention Is All You Need](https://arxiv.org/abs/1706.03762)
|
15 |
+
|
16 |
+
[4] [Qwen/Qwen3-1.7B Model Card](https://huggingface.co/Qwen/Qwen3-1.7B)
|
17 |
+
|
18 |
+
[5] [Training and Inference Efficiency of Encoder-Decoder Speech Models](https://arxiv.org/abs/2503.05931)
|
19 |
+
|
20 |
+
[6] [NVIDIA NeMo Toolkit](https://github.com/NVIDIA/NeMo)
|
21 |
+
|
22 |
+
[7] [Granary: Speech Recognition and Translation Dataset in 25 European Languages](https://arxiv.org/abs/2505.13404)
|
23 |
+
|
24 |
+
[8] [Towards Measuring Fairness in AI: the Casual Conversations Dataset](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9634168)
|
25 |
+
|
26 |
+
[9] [SALM: Speech-augmented Language Model with In-context Learning for Speech Recognition and Translation](https://arxiv.org/abs/2310.09424)
|
27 |
+
|
28 |
+
## Model Architecture:
|
29 |
+
Canary-Qwen is a Speech-Augmented Language Model (SALM) [9] model with FastConformer [2] Encoder and Transformer Decoder [3]. It is built using two base models: `nvidia/canary-1b-flash` [1,5] and `Qwen/Qwen3-1.7B` [4], a linear projection, and LoRA applied to the LLM. The audio encoder computes audio representation that is mapped to the LLM embedding space via a linear projection, and concatenated with the embeddings of text tokens. The model is prompted with "Transcribe the following: <audio>", using Qwen's chat template.
|
30 |
+
|
31 |
+
### Limitations
|
32 |
+
|
33 |
+
**Input length.** The maximum audio duration in training was 40s, and the maximum token sequence length was 1024 tokens (including prompt, audio, and response). The model may technically be able to process longer sequences, but its accuracy may be degraded.
|
34 |
+
|
35 |
+
**Exclusively ASR oriented capabilities.** The model is not expected to preserve any of the underlying LLM's capabilities into speech modality.
|
36 |
+
|
37 |
+
**English-only language support.** The model was trained using English data only. It may be able to spuriously transcribe other languages as the underlying encoder was pretrained using German, French, and Spanish speech in addition to English, but it's unlikely to be reliable as a multilingual model.
|
38 |
+
|
39 |
+
## NVIDIA NeMo
|
40 |
+
|
41 |
+
To train, fine-tune or transcribe with Canary-Qwen-2.5B, you will need to install [NVIDIA NeMo](https://github.com/NVIDIA/NeMo).
|
42 |
+
|
43 |
+
## How to Use this Model
|
44 |
+
|
45 |
+
The model is available for use in the NVIDIA NeMo toolkit [6], and can be used as a pre-trained checkpoint for inference or for fine-tuning on another dataset.
|
46 |
+
|
47 |
+
### Loading the Model
|
48 |
+
|
49 |
+
```python
|
50 |
+
from nemo.collections.speechlm2.models import SALM
|
51 |
+
|
52 |
+
model = SALM.from_pretrained('nvidia/canary-qwen-2.5b')
|
53 |
+
```
|
54 |
+
|
55 |
+
## Input:
|
56 |
+
**Input Type(s):** Audio, text prompt <br>
|
57 |
+
**Input Format(s):** .wav or .flac files<br>
|
58 |
+
**Input Parameters(s):** 1D <br>
|
59 |
+
**Other Properties Related to Input:** 16000 Hz Mono-channel Audio, Pre-Processing Not Needed <br>
|
60 |
+
|
61 |
+
Input to Canary-Qwen-2.5B is a batch of prompts that include audio.
|
62 |
+
|
63 |
+
```python
|
64 |
+
answer_ids = model.generate(
|
65 |
+
prompts=[
|
66 |
+
[{"role": "user", "content": f"Transcribe the following: {model.audio_locator_tag}", "audio": ["speech.wav"]}]
|
67 |
+
],
|
68 |
+
max_new_tokens=128,
|
69 |
+
)
|
70 |
+
print(model.tokenizer.ids_to_text(answer_ids[0].cpu()))
|
71 |
+
```
|
72 |
+
|
73 |
+
To transcribe a dataset of recordings, specify the input as jsonl manifest file, where each line in the file is a dictionary containing the following fields:
|
74 |
+
|
75 |
+
```yaml
|
76 |
+
# Example of a line in input_manifest.json
|
77 |
+
{
|
78 |
+
"audio_filepath": "/path/to/audio.wav", # path to the audio file
|
79 |
+
"duration": 30.0, # duration of the audio
|
80 |
+
}
|
81 |
+
```
|
82 |
+
|
83 |
+
and then use:
|
84 |
+
```bash
|
85 |
+
cd NeMo
|
86 |
+
python examples/speechlm2/salm_generate.py \
|
87 |
+
pretrained_name=nvidia/canary-qwen-2.5b \
|
88 |
+
inputs=input_manifest.json \
|
89 |
+
output_manifest=generations.jsonl \
|
90 |
+
batch_size=128 \
|
91 |
+
user_prompt="Transcribe the following:" # audio locator is added automatically at the end if not present
|
92 |
+
```
|
93 |
+
|
94 |
+
## Output:
|
95 |
+
**Output Type(s):** Text <br>
|
96 |
+
**Output Format:** Text transcript as a sequence of token IDs or a string <br>
|
97 |
+
**Output Parameters:** 1-Dimensional text string <br>
|
98 |
+
**Other Properties Related to Output:** May Need Inverse Text Normalization <br>
|
99 |
+
|
100 |
+
|
101 |
+
## Software Integration:
|
102 |
+
**Runtime Engine(s):**
|
103 |
+
* NeMo - 2.4.0 or higher <br>
|
104 |
+
|
105 |
+
**Supported Hardware Microarchitecture Compatibility:** <br>
|
106 |
+
* [NVIDIA Ampere] <br>
|
107 |
+
* [NVIDIA Blackwell] <br>
|
108 |
+
* [NVIDIA Jetson] <br>
|
109 |
+
* [NVIDIA Hopper] <br>
|
110 |
+
* [NVIDIA Lovelace] <br>
|
111 |
+
* [NVIDIA Pascal] <br>
|
112 |
+
* [NVIDIA Turing] <br>
|
113 |
+
* [NVIDIA Volta] <br>
|
114 |
+
|
115 |
+
**[Preferred/Supported] Operating System(s):** <br>
|
116 |
+
* [Linux] <br>
|
117 |
+
* [Linux 4 Tegra] <br>
|
118 |
+
* [Windows] <br>
|
119 |
+
|
120 |
+
## Model Version(s):
|
121 |
+
Canary-Qwen-2.5B <br>
|
122 |
+
|
123 |
+
|
124 |
+
# Training and Evaluation Datasets:
|
125 |
+
|
126 |
+
## Training Dataset:
|
127 |
+
|
128 |
+
The Canary-Qwen-2.5B model is trained on a total of 234K hrs of publicly available speech data.
|
129 |
+
The datasets below include conversations, videos from the web and audiobook recordings.
|
130 |
+
|
131 |
+
**Data Collection Method:**
|
132 |
+
* Human <br>
|
133 |
+
|
134 |
+
**Labeling Method:**
|
135 |
+
* Hybrid: Human, Automated <br>
|
136 |
+
|
137 |
+
#### English (234.5k hours)
|
138 |
+
|
139 |
+
The majority of the training data come from English portion of the Granary dataset [7]:
|
140 |
+
|
141 |
+
- YouTube-Commons (YTC) (109.5k hours)
|
142 |
+
- YODAS2 (77k hours)
|
143 |
+
- LibriLight (13.6k hours)
|
144 |
+
|
145 |
+
In addition, the following datasets were used:
|
146 |
+
- Librispeech 960 hours
|
147 |
+
- Fisher Corpus
|
148 |
+
- Switchboard-1 Dataset
|
149 |
+
- WSJ-0 and WSJ-1
|
150 |
+
- National Speech Corpus (Part 1, Part 6)
|
151 |
+
- VCTK
|
152 |
+
- VoxPopuli (EN)
|
153 |
+
- Europarl-ASR (EN)
|
154 |
+
- Multilingual Librispeech (MLS EN)
|
155 |
+
- Mozilla Common Voice (v11.0)
|
156 |
+
- Mozilla Common Voice (v7.0)
|
157 |
+
- Mozilla Common Voice (v4.0)
|
158 |
+
- AMI
|
159 |
+
- FLEURS
|
160 |
+
|
161 |
+
AMI was oversampled during model training to constitute about 15% of the total data observed.
|
162 |
+
This skewed the model towards predicting verbatim transcripts that include conversational speech disfluencies such as repetitions.
|
163 |
+
|
164 |
+
The training transcripts contained punctuation and capitalization.
|
165 |
+
|
166 |
+
## Evaluation Dataset:
|
167 |
+
|
168 |
+
**Data Collection Method:** <br>
|
169 |
+
* Human <br>
|
170 |
+
|
171 |
+
**Labeling Method:** <br>
|
172 |
+
* Human <br>
|
173 |
+
|
174 |
+
Automatic Speech Recognition:
|
175 |
+
* [HuggingFace OpenASR Leaderboard evaluation sets](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard)
|
176 |
+
|
177 |
+
Hallucination Robustness:
|
178 |
+
* [MUSAN](https://www.openslr.org/17/) 48 hrs eval set
|
179 |
+
|
180 |
+
Noise Robustness:
|
181 |
+
* [Librispeech](https://www.openslr.org/12)
|
182 |
+
|
183 |
+
Model Fairness:
|
184 |
+
* [Casual Conversations Dataset](https://arxiv.org/pdf/2104.02821)
|
185 |
+
|
186 |
+
## Training
|
187 |
+
|
188 |
+
Canary-Qwen-2.5B was trained using the NVIDIA NeMo toolkit [6] for a total of 90k steps on 32 NVIDIA A100 80GB GPUs. LLM parameters were kept frozen. Speech encoder, projection, and LoRA parameters were trainable. The encoder's output frame rate is 80ms, or 12.5 tokens per second. The model was trained on approximately 1.3B tokens in total (this number inlcudes the speech encoder output frames, text response tokens, prompt tokens, and chat template tokens).
|
189 |
+
|
190 |
+
The model can be trained using this [example script](https://github.com/NVIDIA/NeMo/blob/main/examples/speechlm2/salm_train.py) and [base config](https://github.com/NVIDIA/NeMo/blob/main/examples/speechlm2/conf/salm.yaml).
|
191 |
+
|
192 |
+
The tokenizer was inherited from `Qwen/Qwen3-1.7B`.
|
193 |
+
|
194 |
+
## Inference:
|
195 |
+
**Engine:** NVIDIA NeMo <br>
|
196 |
+
**Test Hardware :** <br>
|
197 |
+
* A6000 <br>
|
198 |
+
* A100 <br>
|
199 |
+
|
200 |
+
## Performance
|
201 |
+
|
202 |
+
The ASR predictions were generated using greedy decoding.
|
203 |
+
|
204 |
+
### ASR Performance (w/o PnC)
|
205 |
+
|
206 |
+
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/) version 0.1.12.
|
207 |
+
|
208 |
+
WER on [HuggingFace OpenASR leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard):
|
209 |
+
|
210 |
+
| **Version** | **Model** | **RTFx** | **Mean** | **AMI** | **GigaSpeech** | **LS Clean** | **LS Other** | **Earnings22** | **SPGISpech** | **Tedlium** | **Voxpopuli** |
|
211 |
+
|:---------:|:-----------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|
212 |
+
| 2.4.0 | Canary-Qwen-2.5B | 458.5 | 5.62 | 10.18 | 9.41 | 1.60 | 3.10 | 10.42 | 1.90 | 2.72 | 5.66 |
|
213 |
+
|
214 |
+
More details on evaluation can be found at [HuggingFace ASR Leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard)
|
215 |
+
|
216 |
+
### Hallucination Robustness
|
217 |
+
Number of characters per minute on [MUSAN](https://www.openslr.org/17) 48 hrs eval set (`max_new_tokens=50` following `nvidia/canary-1b-flash` evaluation)
|
218 |
+
| **Version** | **Model** | **# of character per minute** |
|
219 |
+
|:-----------:|:---------:|:----------:|
|
220 |
+
| 2.4.0 | Canary-Qwen-2.5B | 138.1 |
|
221 |
+
|
222 |
+
### Noise Robustness
|
223 |
+
WER on [Librispeech Test Clean](https://www.openslr.org/12) at different SNR (signal to noise ratio) levels of additive white noise
|
224 |
+
|
225 |
+
| **Version** | **Model** | **SNR 10** | **SNR 5** | **SNR 0** | **SNR -5** |
|
226 |
+
|:-----------:|:---------:|:----------:|:----------:|:----------:|:----------:|
|
227 |
+
| 2.4.0 | Canary-Qwen-2.5B | 2.41% | 4.08% | 9.83% | 30.60% |
|
228 |
+
|
229 |
+
## Model Fairness Evaluation
|
230 |
+
|
231 |
+
As outlined in the paper "Towards Measuring Fairness in AI: the Casual Conversations Dataset" [8], we assessed the Canary-Qwen-2.5B model for fairness. The model was evaluated on the CasualConversations-v1 dataset with inference done on non-overlapping 40s chunks, and the results are reported as follows:
|
232 |
+
|
233 |
+
### Gender Bias:
|
234 |
+
|
235 |
+
| Gender | Male | Female | N/A | Other |
|
236 |
+
| :--- | :--- | :--- | :--- | :--- |
|
237 |
+
| Num utterances | 18471 | 23378 | 880 | 18 |
|
238 |
+
| % WER | 16.71 | 13.85 | 17.71 | 29.46 |
|
239 |
+
|
240 |
+
### Age Bias:
|
241 |
+
|
242 |
+
| Age Group | (18-30) | (31-45) | (46-85) | (1-100) |
|
243 |
+
| :--- | :--- | :--- | :--- | :--- |
|
244 |
+
| Num utterances | 15058 | 13984 | 12810 | 41852 |
|
245 |
+
| % WER | 15.73 | 15.3 | 14.14 | 15.11 |
|
246 |
+
|
247 |
+
(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.)
|
248 |
+
|
249 |
+
## Ethical Considerations:
|
250 |
+
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
|
251 |
+
For more detailed information on ethical considerations for this model, please see the Model Card++ Explainability, Bias, Safety & Security, and Privacy Subcards. Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
|
252 |
+
|
app.py
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import json
|
3 |
-
import os
|
4 |
-
import soundfile as sf
|
5 |
-
import tempfile
|
6 |
-
import uuid
|
7 |
-
import torch
|
8 |
-
from lhotse import Recording
|
9 |
-
from lhotse.dataset import DynamicCutSampler
|
10 |
-
|
11 |
-
from nemo.collections.speechlm2 import SALM
|
12 |
-
from nemo.collections.asr.parts.utils.streaming_utils import FrameBatchMultiTaskAED
|
13 |
-
from nemo.collections.asr.parts.utils.transcribe_utils import get_buffered_pred_feat_multitaskAED
|
14 |
-
|
15 |
-
if torch.cuda.is_available():
|
16 |
-
device = torch.device("cuda")
|
17 |
-
else:
|
18 |
-
device = torch.device("cpu")
|
19 |
-
|
20 |
-
SAMPLE_RATE = 16000 # Hz
|
21 |
-
MAX_AUDIO_MINUTES = 10 # wont try to transcribe if longer than this
|
22 |
-
CHUNK_SECONDS = 40.0 # max audio length seen by the model
|
23 |
-
BATCH_SIZE = 4 # for parallel transcription of audio longer than CHUNK_SECONDS
|
24 |
-
|
25 |
-
with device:
|
26 |
-
torch.set_default_dtype(torch.bfloat16) # speed up start-up time
|
27 |
-
model = SALM.from_pretrained("nvidia/canary-qwen-2.5b").bfloat16().eval().to(device)
|
28 |
-
torch.set_default_dtype(torch.float32)
|
29 |
-
|
30 |
-
|
31 |
-
def as_batches(audio_filepath, utt_id):
|
32 |
-
rec = Recording.from_file(audio_filepath, recording_id=utt_id)
|
33 |
-
if rec.duration / 60.0 > MAX_AUDIO_MINUTES:
|
34 |
-
raise gr.Error(
|
35 |
-
f"This demo can transcribe up to {MAX_AUDIO_MINUTES} minutes of audio. "
|
36 |
-
"If you wish, you may trim the audio using the Audio viewer in Step 1 "
|
37 |
-
"(click on the scissors icon to start trimming audio)."
|
38 |
-
)
|
39 |
-
cut = rec.resample(SAMPLE_RATE).to_cut()
|
40 |
-
if cut.num_channels > 1:
|
41 |
-
cut = cut.to_mono(mono_downmix=True)
|
42 |
-
return DynamicCutSampler(cut.cut_into_windows(CHUNK_SECONDS), max_cuts=BATCH_SIZE)
|
43 |
-
|
44 |
-
|
45 |
-
def transcribe(audio_filepath):
|
46 |
-
if audio_filepath is None:
|
47 |
-
raise gr.Error("Please provide some input audio: either upload an audio file or use the microphone")
|
48 |
-
utt_id = uuid.uuid4()
|
49 |
-
pred_text = []
|
50 |
-
for batch in as_batches(audio_filepath, str(utt_id)):
|
51 |
-
audio, audio_lens = batch.load_audio(collate=True)
|
52 |
-
with torch.inference_mode():
|
53 |
-
output_ids = model.generate(
|
54 |
-
prompts=[[{"role": "user", "content": f"Transcribe the following: {model.audio_locator_tag}"}]] * len(batch),
|
55 |
-
audios=torch.as_tensor(audio).to(device, non_blocking=True),
|
56 |
-
audio_lens=torch.as_tensor(audio_lens).to(device, non_blocking=True),
|
57 |
-
max_new_tokens=256,
|
58 |
-
)
|
59 |
-
pred_text.extend(model.tokenizer.ids_to_text(oids) for oids in output_ids.cpu())
|
60 |
-
return ' '.join(pred_text)
|
61 |
-
|
62 |
-
|
63 |
-
with gr.Blocks(
|
64 |
-
title="NeMo Canary-Qwen-2.5B Model",
|
65 |
-
css="""
|
66 |
-
textarea { font-size: 18px;}
|
67 |
-
#model_output_text_box span {
|
68 |
-
font-size: 18px;
|
69 |
-
font-weight: bold;
|
70 |
-
}
|
71 |
-
""",
|
72 |
-
theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg) # make text slightly bigger (default is text_md )
|
73 |
-
) as demo:
|
74 |
-
|
75 |
-
gr.HTML("<h1 style='text-align: center'>NeMo Canary-Qwen-2.5B model: Transcribe audio</h1>")
|
76 |
-
|
77 |
-
with gr.Row():
|
78 |
-
with gr.Column():
|
79 |
-
gr.HTML(
|
80 |
-
"<p><b>Step 1:</b> Upload an audio file or record with your microphone.</p>"
|
81 |
-
|
82 |
-
"<p style='color: #A0A0A0;'>This demo supports audio files up to 10 mins long. "
|
83 |
-
"You can transcribe longer files locally with NeMo. "
|
84 |
-
#"<a href='https://github.com/NVIDIA/NeMo/blob/main/examples/asr/asr_chunked_inference/aed/speech_to_text_aed_chunked_infer.py'>script</a>.</p>"
|
85 |
-
)
|
86 |
-
|
87 |
-
audio_file = gr.Audio(sources=["microphone", "upload"], type="filepath")
|
88 |
-
|
89 |
-
with gr.Column():
|
90 |
-
|
91 |
-
gr.HTML("<p><b>Step 2:</b> Run the model.</p>")
|
92 |
-
|
93 |
-
go_button = gr.Button(
|
94 |
-
value="Run model",
|
95 |
-
variant="primary", # make "primary" so it stands out (default is "secondary")
|
96 |
-
)
|
97 |
-
|
98 |
-
model_output_text_box = gr.Textbox(
|
99 |
-
label="Model Output",
|
100 |
-
elem_id="model_output_text_box",
|
101 |
-
)
|
102 |
-
|
103 |
-
with gr.Row():
|
104 |
-
|
105 |
-
gr.HTML(
|
106 |
-
"<p style='text-align: center'>"
|
107 |
-
"🐤 <a href='https://huggingface.co/nvidia/canary-qwen-2.5b' target='_blank'>Canary model</a> | "
|
108 |
-
"🧑💻 <a href='https://github.com/NVIDIA/NeMo' target='_blank'>NeMo Repository</a>"
|
109 |
-
"</p>"
|
110 |
-
)
|
111 |
-
|
112 |
-
go_button.click(
|
113 |
-
fn=transcribe,
|
114 |
-
inputs=[audio_file],
|
115 |
-
outputs=[model_output_text_box]
|
116 |
-
)
|
117 |
-
|
118 |
-
|
119 |
-
demo.queue()
|
120 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
packages.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
ffmpeg
|
2 |
-
libsndfile1
|
|
|
|
|
|
pre-requirements.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Cython
|
|
|
|
requirements.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
nemo_toolkit[asr] @ git+https://github.com/NVIDIA/NeMo.git
|
2 |
-
sacrebleu
|
3 |
-
seaborn
|
|
|
|
|
|
|
|