Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
base_model:
|
6 |
+
- nvidia/parakeet-tdt-0.6b-v2
|
7 |
+
pipeline_tag: automatic-speech-recognition
|
8 |
+
---
|
9 |
+
|
10 |
+
NVIDIA Parakeet TDT 0.6B V2 (En) [model](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v2) converted to ONNX format for [onnx-asr](https://github.com/istupakov/onnx-asr).
|
11 |
+
|
12 |
+
Install onnx-asr
|
13 |
+
```shell
|
14 |
+
pip install onnx-asr[cpu,hub]
|
15 |
+
```
|
16 |
+
|
17 |
+
Load Parakeet TDT model and recognize wav file
|
18 |
+
```py
|
19 |
+
import onnx_asr
|
20 |
+
model = onnx_asr.load_model("nemo-parakeet-tdt-0.6b-v2")
|
21 |
+
print(model.recognize("test.wav"))
|
22 |
+
```
|
23 |
+
|
24 |
+
Code for models export
|
25 |
+
```py
|
26 |
+
import nemo.collections.asr as nemo_asr
|
27 |
+
from pathlib import Path
|
28 |
+
|
29 |
+
model = nemo_asr.models.ASRModel.from_pretrained("nvidia/parakeet-tdt-0.6b-v2")
|
30 |
+
|
31 |
+
onnx_dir = Path("nemo-onnx")
|
32 |
+
onnx_dir.mkdir(exist_ok=True)
|
33 |
+
model.export(str(Path(onnx_dir, "model.onnx")))
|
34 |
+
|
35 |
+
with Path(onnx_dir, "vocab.txt").open("wt") as f:
|
36 |
+
for i, token in enumerate([*model.tokenizer.vocab, "<blk>"]):
|
37 |
+
f.write(f"{token} {i}\n")
|
38 |
+
```
|