Skip to content

Commit 5bc286f

Browse files
authored
Export nvidia/parakeet-unified-en-0.6b to sherpa-onnx (k2-fsa#3556)
1 parent 415b8c2 commit 5bc286f

15 files changed

Lines changed: 908 additions & 28 deletions

File tree

.github/workflows/apk-vad-asr-simulated-streaming.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-latest]
26-
total: ["25"]
27-
index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"]
26+
total: ["30"]
27+
index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"]
2828

2929
steps:
3030
- uses: actions/checkout@v4

.github/workflows/apk-vad-asr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-latest]
26-
total: ["25"]
27-
index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"]
26+
total: ["30"]
27+
index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"]
2828

2929
steps:
3030
- uses: actions/checkout@v4
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: export-nemo-parakeet-unified-en-0.6b
2+
3+
on:
4+
push:
5+
branches:
6+
- export-nemo-parakeet-unified-en-0.6b-2
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: export-nemo-parakeet-unified-en-0.6b-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
HF_HUB_ENABLE_HF_TRANSFER: "0"
15+
16+
jobs:
17+
export-nemo-parakeet-unified-en-0_6b:
18+
if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj'
19+
name: parakeet unified-en 0.6b
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [macos-latest]
25+
python-version: ["3.10"]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Show disk space
31+
run: |
32+
df -h
33+
34+
# See https://github.com/vlayer-xyz/vlayer/pull/543/files
35+
# Free up disk space as the macOS runners end up using most for Xcode
36+
# versions we don't need and use iOS simulators.
37+
- name: Free up disk space
38+
run: |
39+
echo '*** Delete iOS simulators and their caches'
40+
xcrun simctl delete all
41+
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
42+
43+
- name: Show disk space
44+
run: |
45+
df -h
46+
47+
- name: Setup Python ${{ matrix.python-version }}
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version: ${{ matrix.python-version }}
51+
52+
- name: Run
53+
shell: bash
54+
run: |
55+
cd scripts/nemo/parakeet-unified-en-0.6b/
56+
./run.sh
57+
58+
ls -lh *.onnx
59+
ls -lh *.weights
60+
61+
mv -v *.onnx ../../..
62+
mv -v *.weights ../../..
63+
mv -v tokens.txt ../../..
64+
mv 2086-149220-0033.wav ../../../0.wav
65+
66+
- name: Collect files (fp32)
67+
shell: bash
68+
run: |
69+
d=sherpa-onnx-nemo-parakeet-unified-en-0.6b-non-streaming
70+
mkdir -p $d
71+
cp -v encoder.onnx $d
72+
cp -v encoder.weights $d
73+
cp -v decoder.onnx $d
74+
cp -v joiner.onnx $d
75+
cp -v tokens.txt $d
76+
77+
cp -v scripts/nemo/parakeet-unified-en-0.6b/bias.md $d
78+
cp -v scripts/nemo/parakeet-unified-en-0.6b/explainability.md $d
79+
cp -v scripts/nemo/parakeet-unified-en-0.6b/privacy.md $d
80+
cp -v scripts/nemo/parakeet-unified-en-0.6b/safety.md $d
81+
82+
ls -lh $d
83+
84+
mkdir $d/test_wavs
85+
cp -v *.wav $d/test_wavs
86+
87+
# The fp32 model is larger than 2GB
88+
# tar cjfv $d.tar.bz2 $d
89+
90+
# ls -lh *.tar.bz2
91+
92+
- name: Collect files (int8)
93+
shell: bash
94+
run: |
95+
version=${{ matrix.version }}
96+
d=sherpa-onnx-nemo-parakeet-unified-en-0.6b-int8-non-streaming
97+
mkdir -p $d
98+
cp -v encoder.int8.onnx $d
99+
cp -v decoder.int8.onnx $d
100+
cp -v joiner.int8.onnx $d
101+
cp -v tokens.txt $d
102+
103+
cp -v scripts/nemo/parakeet-unified-en-0.6b/bias.md $d
104+
cp -v scripts/nemo/parakeet-unified-en-0.6b/explainability.md $d
105+
cp -v scripts/nemo/parakeet-unified-en-0.6b/privacy.md $d
106+
cp -v scripts/nemo/parakeet-unified-en-0.6b/safety.md $d
107+
108+
ls -lh $d
109+
110+
mkdir $d/test_wavs
111+
cp -v *.wav $d/test_wavs
112+
113+
tar cjfv $d.tar.bz2 $d
114+
115+
ls -lh *.tar.bz2
116+
117+
- name: Publish to huggingface
118+
env:
119+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
120+
uses: nick-fields/retry@v3
121+
with:
122+
max_attempts: 20
123+
timeout_seconds: 200
124+
shell: bash
125+
command: |
126+
git config --global user.email "csukuangfj@gmail.com"
127+
git config --global user.name "Fangjun Kuang"
128+
129+
models=(
130+
sherpa-onnx-nemo-parakeet-unified-en-0.6b-int8-non-streaming
131+
sherpa-onnx-nemo-parakeet-unified-en-0.6b-non-streaming
132+
)
133+
134+
for m in ${models[@]}; do
135+
rm -rf huggingface
136+
export GIT_LFS_SKIP_SMUDGE=1
137+
export GIT_CLONE_PROTECTION_ACTIVE=false
138+
git clone https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m huggingface
139+
cp -av $m/* huggingface
140+
cd huggingface
141+
git lfs track "*.onnx"
142+
git lfs track "*.wav"
143+
git lfs track "*.weights"
144+
git status
145+
git add .
146+
git status
147+
git commit -m "first commit"
148+
git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main
149+
cd ..
150+
done
151+
152+
- name: Release
153+
uses: svenstaro/upload-release-action@v2
154+
with:
155+
file_glob: true
156+
file: ./*.tar.bz2
157+
overwrite: true
158+
repo_name: k2-fsa/sherpa-onnx
159+
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
160+
tag: asr-models

.github/workflows/tauri-vad-asr-mic.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: tauri-vad-asr-mic
33
on:
44
push:
55
branches:
6-
- tauri-vad-asr-mic
6+
- apk
77

88
workflow_dispatch:
99

@@ -40,15 +40,6 @@ jobs:
4040
4141
- uses: dtolnay/rust-toolchain@stable
4242

43-
- name: Install Python dependencies
44-
shell: bash
45-
run: |
46-
if [[ "${{ runner.os }}" == "macOS" ]]; then
47-
python3 -m pip install --upgrade --break-system-packages pip jinja2 pillow
48-
else
49-
python3 -m pip install --upgrade pip jinja2 pillow
50-
fi
51-
5243
- name: Install Tauri CLI
5344
shell: bash
5445
run: |

.github/workflows/tauri-vad-asr.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: tauri-vad-asr
33
on:
44
push:
55
branches:
6-
- fix-tauri
6+
- apk
77

88
workflow_dispatch:
99

@@ -40,15 +40,6 @@ jobs:
4040
4141
- uses: dtolnay/rust-toolchain@stable
4242

43-
- name: Install Python dependencies
44-
shell: bash
45-
run: |
46-
if [[ "${{ runner.os }}" == "macOS" ]]; then
47-
python3 -m pip install --upgrade --break-system-packages pip jinja2 pillow
48-
else
49-
python3 -m pip install --upgrade pip jinja2 pillow
50-
fi
51-
5243
- name: Install Tauri CLI
5344
shell: bash
5445
run: |

scripts/apk/generate-vad-asr-apk-script.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def get_models():
360360
idx=19,
361361
lang="ru",
362362
lang2="Russian",
363-
short_name="nemo_ctc_giga_am",
363+
short_name="nemo_ctc_giga_am_2024_10_24",
364364
cmd="""
365365
pushd $model_name
366366
@@ -379,7 +379,7 @@ def get_models():
379379
idx=20,
380380
lang="ru",
381381
lang2="Russian",
382-
short_name="nemo_transducer_giga_am",
382+
short_name="nemo_transducer_giga_am_2024_10_24",
383383
cmd="""
384384
pushd $model_name
385385
@@ -483,7 +483,7 @@ def get_models():
483483
idx=27,
484484
lang="ru",
485485
lang2="Russian",
486-
short_name="nemo_ctc_giga_am_v2",
486+
short_name="nemo_ctc_giga_am_v2_2025_04_19",
487487
cmd="""
488488
pushd $model_name
489489
@@ -502,7 +502,7 @@ def get_models():
502502
idx=28,
503503
lang="ru",
504504
lang2="Russian",
505-
short_name="nemo_transducer_giga_am",
505+
short_name="nemo_transducer_giga_am_v2_2025_04_19",
506506
cmd="""
507507
pushd $model_name
508508
@@ -1030,6 +1030,22 @@ def get_models():
10301030
10311031
ls -lh
10321032
1033+
popd
1034+
""",
1035+
),
1036+
Model(
1037+
model_name="sherpa-onnx-nemo-parakeet-unified-en-0.6b-int8-non-streaming",
1038+
idx=62,
1039+
lang="en",
1040+
lang2="English",
1041+
short_name="parakeet_unified_en_non_streaming_0.6b_int8",
1042+
cmd="""
1043+
pushd $model_name
1044+
1045+
rm -rfv test_wavs
1046+
1047+
ls -lh
1048+
10331049
popd
10341050
""",
10351051
),
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Introduction
2+
3+
This folder contains scripts to export the model from
4+
<https://huggingface.co/nvidia/parakeet-unified-en-0.6b>
5+
to sherpa-onnx.
6+
7+
## asr_model.cfg
8+
9+
```
10+
{'sample_rate': 16000, 'compute_eval_loss': False, 'log_prediction': True,
11+
'rnnt_reduction': 'mean_volume', 'skip_nan_grad': False,
12+
'model_defaults': {'enc_hidden': 1024, 'pred_hidden': 640, 'joint_hidden': 640},
13+
'train_ds': {'use_lhotse': True, 'skip_missing_manifest_entries': True, 'input_cfg': None,
14+
'manifest_filepath': None, 'sample_rate': 16000, 'batch_size': 16, 'shuffle': True,
15+
'num_workers': 8, 'pin_memory': True, 'max_duration': 40.0, 'min_duration': 0.1,
16+
'text_field': 'answer', 'batch_duration': None, 'use_bucketing': True,
17+
'max_tps': None, 'bucket_duration_bins': None, 'bucket_batch_size': None,
18+
'num_buckets': None, 'bucket_buffer_size': None, 'shuffle_buffer_size': None, 'tarred_audio_filepaths': None,
19+
'augmentor': None}, 'validation_ds': {},
20+
'tokenizer': {'dir': None, 'type': 'bpe', 'model_path': 'nemo:c9e35cde64e14bdc87cf70d543842217_tokenizer.model',
21+
'vocab_path': 'nemo:28f042954ba747e99209b8ca5a223ba3_vocab.txt', 'spe_tokenizer_vocab': 'nemo:aa68b93b03344274b0c0e2a96333de24_tokenizer.vocab'},
22+
'preprocessor': {'_target_': 'nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor',
23+
'sample_rate': 16000, 'normalize': 'per_feature', 'window_size': 0.025, 'window_stride': 0.01,
24+
'window': 'hann', 'features': 128, 'n_fft': 512, 'frame_splicing': 1,
25+
'dither': 1e-05, 'pad_to': 0, 'pad_value': 0.0},
26+
'spec_augment': {'_target_': 'nemo.collections.asr.modules.SpectrogramAugmentation', 'freq_masks': 2, 'time_masks': 10, 'freq_width': 27, 'time_width': 0.05},
27+
'encoder': {'_target_': 'nemo.collections.asr.modules.ConformerEncoder',
28+
'feat_in': 128, 'feat_out': -1, 'n_layers': 24, 'd_model': 1024,
29+
'subsampling': 'dw_striding', 'subsampling_factor': 8, 'subsampling_conv_channels': 256,
30+
'causal_downsampling': False, 'reduction': None, 'reduction_position': None,
31+
'reduction_factor': 1, 'ff_expansion_factor': 4,
32+
'self_attention_model': 'rel_pos', 'n_heads': 8, 'att_context_size': [-1, -1],
33+
'att_chunk_context_size': [[70], [1, 2, 7, 13], [0, 1, 2, 3, 4, 7, 13]], 'att_context_style': 'chunked_limited_with_rc',
34+
'xscaling': True, 'untie_biases': True, 'pos_emb_max_len': 5000, 'conv_kernel_size': 9, 'conv_norm_type': 'batch_norm',
35+
'conv_context_size': None, 'conv_context_style': 'dcc', 'dropout': 0.1, 'dropout_pre_encoder': 0.1, 'dropout_emb': 0.0,
36+
'dropout_att': 0.1, 'stochastic_depth_drop_prob': 0.0, 'stochastic_depth_mode': 'linear', 'stochastic_depth_start_layer': 1},
37+
'decoder': {'_target_': 'nemo.collections.asr.modules.RNNTDecoder',
38+
'normalization_mode': None, 'random_state_sampling': False, 'blank_as_pad': True,
39+
'prednet': {'pred_hidden': 640, 'pred_rnn_layers': 2, 't_max': None, 'dropout': 0.2},
40+
'vocab_size': 1024},
41+
'joint': {
42+
'_target_': 'nemo.collections.asr.modules.RNNTJoint', 'log_softmax': None,
43+
'preserve_memory': False, 'fuse_loss_wer': False,
44+
'fused_batch_size': -1,
45+
'jointnet': {'joint_hidden': 640, 'activation': 'relu', 'dropout': 0.2,
46+
'encoder_hidden': 1024, 'pred_hidden': 640}, 'num_classes': 1024,
47+
'vocabulary': ['<unk>', '▁t', '▁th', ... ... '&', '*', '/', '£', '+', '€', '_', '^', '¥']},
48+
'decoding': {'strategy': 'greedy_batch', 'greedy': {'max_symbols': 10, 'use_cuda_graph_decoder': False},
49+
'beam': {'beam_size': 2, 'return_best_hypothesis': False, 'score_norm': True, 'tsd_max_sym_exp': 50, 'alsd_max_target_len': 2.0}},
50+
'loss': {'loss_name': 'default', 'offline_loss_weight': 0.3, 'streaming_loss_weight': 0.7},
51+
'optim': {'name': 'adamw', 'lr': 0.0001, 'betas': [0.9, 0.98], 'weight_decay': 0.001, 'sched': {'name': 'CosineAnnealing', 'warmup_steps': 3000, 'warmup_ratio': None, 'min_lr': 5e-06}},
52+
'labels': ['<unk>', '▁t', '▁th', '▁a', 'in', '▁the', ... .... '"', '&', '*', '/', '£', '+', '€', '_', '^', '¥'],
53+
'target': 'nemo.collections.asr.models.rnnt_bpe_models.EncDecRNNTBPEModel', 'nemo_version': '2.7.0rc0'}
54+
```

0 commit comments

Comments
 (0)