Export NeMo unified streaming 0.6b models#3602
Conversation
📝 WalkthroughWalkthroughThis PR introduces a complete streaming export pipeline for NeMo Parakeet unified models, comprising a shell script that automates model download, ONNX artifact export across multiple latency configurations, inference testing, and output packaging, paired with a GitHub Actions workflow that orchestrates execution on macOS, publishes models to Hugging Face, and uploads release artifacts. ChangesNeMo Parakeet Streaming Export Pipeline
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new bash script for streaming ASR with the Parakeet Unified model and updates copyright headers in associated test files. Review feedback identifies several issues in the bash script: redundant directory listings, a configuration error where the fp32 test incorrectly uses an int8 encoder, and a potential script failure caused by moving the tokens file instead of copying it within a loop.
| ls -lh | ||
| echo "---" | ||
| ls -lh | ||
| echo "---" |
|
|
||
| echo "---fp32----" | ||
| python3 ./test_onnx_streaming.py \ | ||
| --encoder ./encoder.int8.onnx \ |
There was a problem hiding this comment.
| mv -v encoder.int8.onnx $d | ||
| mv -v decoder.int8.onnx $d | ||
| mv -v joiner.int8.onnx $d | ||
| mv -v tokens.txt $d |
There was a problem hiding this comment.
tokens.txt is moved (mv) here, but it was copied (cp) at line 72. If tokens.txt is not regenerated by the export script in every loop iteration, the script will fail in subsequent iterations because the file will be missing. Using cp is safer and more consistent with how other metadata files are handled.
| mv -v tokens.txt $d | |
| cp -v tokens.txt $d |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/export-nemo-parakeet-unified-en-0.6b-streaming.yaml:
- Around line 93-97: The workflow currently runs git add . followed by git
commit -m "first commit" which fails when there are no staged changes; update
the step to detect whether there are staged changes (e.g., use git diff --cached
--quiet or equivalent) and only run git commit -m "first commit" when changes
exist, otherwise skip the commit and continue to the git push
https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main step so the
publish is idempotent.
In `@scripts/nemo/parakeet-unified-en-0.6b/run-streaming.sh`:
- Around line 57-63: The fp32 smoke test is incorrectly using the int8 encoder
file (encoder.int8.onnx) so the fp32 path is never exercised; update the fp32
block that echoes "---fp32----" to pass the fp32 encoder (e.g., encoder.onnx) to
test_onnx_streaming.py instead of encoder.int8.onnx, ensuring the call that
includes --encoder matches the fp32 model filename and that the int8 test block
still uses encoder.int8.onnx.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b0e3fa9a-d821-4555-ac68-52feccffa61e
📒 Files selected for processing (5)
.github/workflows/export-nemo-parakeet-unified-en-0.6b-streaming.yamlscripts/nemo/parakeet-unified-en-0.6b/export_onnx_streaming.pyscripts/nemo/parakeet-unified-en-0.6b/run-streaming.shscripts/nemo/parakeet-unified-en-0.6b/test_buffered_streaming_helpers.pyscripts/nemo/parakeet-unified-en-0.6b/test_onnx_streaming.py
| git add . | ||
| git status | ||
| git commit -m "first commit" | ||
| git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main | ||
| cd .. |
There was a problem hiding this comment.
Make HF publish idempotent by guarding empty commits.
git commit at Line 95 fails when there are no staged changes, which can fail the whole publish step even though nothing is wrong.
Suggested fix
git add .
git status
- git commit -m "first commit"
- git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main
+ if git diff --cached --quiet; then
+ echo "No changes to push for $m"
+ else
+ git commit -m "Update model artifacts"
+ git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main
+ fi
cd ..📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| git add . | |
| git status | |
| git commit -m "first commit" | |
| git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main | |
| cd .. | |
| git add . | |
| git status | |
| if git diff --cached --quiet; then | |
| echo "No changes to push for $m" | |
| else | |
| git commit -m "Update model artifacts" | |
| git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main | |
| fi | |
| cd .. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/export-nemo-parakeet-unified-en-0.6b-streaming.yaml around
lines 93 - 97, The workflow currently runs git add . followed by git commit -m
"first commit" which fails when there are no staged changes; update the step to
detect whether there are staged changes (e.g., use git diff --cached --quiet or
equivalent) and only run git commit -m "first commit" when changes exist,
otherwise skip the commit and continue to the git push
https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main step so the
publish is idempotent.
| echo "---fp32----" | ||
| python3 ./test_onnx_streaming.py \ | ||
| --encoder ./encoder.int8.onnx \ | ||
| --decoder ./decoder.onnx \ | ||
| --joiner ./joiner.onnx \ | ||
| --tokens ./tokens.txt \ | ||
| --wav 2086-149220-0033.wav |
There was a problem hiding this comment.
fp32 smoke test is wired to the int8 encoder.
Line 59 points to encoder.int8.onnx inside the ---fp32---- block, so the fp32 encoder path is never actually tested.
Suggested fix
echo "---fp32----"
python3 ./test_onnx_streaming.py \
- --encoder ./encoder.int8.onnx \
+ --encoder ./encoder.onnx \
--decoder ./decoder.onnx \
--joiner ./joiner.onnx \
--tokens ./tokens.txt \
--wav 2086-149220-0033.wav📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| echo "---fp32----" | |
| python3 ./test_onnx_streaming.py \ | |
| --encoder ./encoder.int8.onnx \ | |
| --decoder ./decoder.onnx \ | |
| --joiner ./joiner.onnx \ | |
| --tokens ./tokens.txt \ | |
| --wav 2086-149220-0033.wav | |
| echo "---fp32----" | |
| python3 ./test_onnx_streaming.py \ | |
| --encoder ./encoder.onnx \ | |
| --decoder ./decoder.onnx \ | |
| --joiner ./joiner.onnx \ | |
| --tokens ./tokens.txt \ | |
| --wav 2086-149220-0033.wav |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/nemo/parakeet-unified-en-0.6b/run-streaming.sh` around lines 57 - 63,
The fp32 smoke test is incorrectly using the int8 encoder file
(encoder.int8.onnx) so the fp32 path is never exercised; update the fp32 block
that echoes "---fp32----" to pass the fp32 encoder (e.g., encoder.onnx) to
test_onnx_streaming.py instead of encoder.int8.onnx, ensuring the call that
includes --encoder matches the fp32 model filename and that the int8 test block
still uses encoder.int8.onnx.
See also #3575
cc @milanleonard
The exported models can be found at
https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models
Usage
Logs are
Summary by CodeRabbit