Skip to content

Build huggingface spaces for Moonshine v2 with WebAssembly - #3249

Merged
csukuangfj merged 4 commits into
k2-fsa:masterfrom
csukuangfj:wasm-moonshine-v2
Feb 28, 2026
Merged

csukuangfj merged 4 commits into
k2-fsa:masterfrom
csukuangfj:wasm-moonshine-v2

Conversation

@csukuangfj

@csukuangfj csukuangfj commented Feb 28, 2026 •

Copy link
Copy Markdown
Collaborator

You can find them in the following addresses

Model Language URL
tiny-ko Korean Address
tiny-ja Japanese Address
tiny-en English Address
base-zh Chinese Address
base-vi Vietnamese Address
base-uk Ukrainian Address
base-ja Japanese Address
base-es Spanish Address
base-en English Address
base-ar Arabic Address

A screenshot is given below:
Screenshot 2026-02-28 at 15 46 23

Summary by CodeRabbit

  • New Features

    • Added support for Moonshine v2 offline speech models across multiple languages (en, ja, ko, zh, vi, es, ar, uk), improving on-device recognition options.
  • Chores

    • Increased CI workflow parallelism to speed up builds and deployments.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 28, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the capabilities of the WebAssembly VAD-ASR system by integrating a new generation of Moonshine v2 models. It enables support for a wider array of languages and model sizes within the existing framework, ensuring that the WebAssembly application can correctly utilize these new models. The changes also refine the deployment process for these models to various platforms.

Highlights

  • Moonshine v2 Model Integration: Added configurations for ten new Moonshine v2 models, including 'tiny' and 'base' versions supporting English, Japanese, Korean, Chinese, Vietnamese, Spanish, Arabic, and Ukrainian languages, to the VAD-ASR generation script.
  • WebAssembly Application Update: Modified the WebAssembly VAD-ASR application to correctly identify and load Moonshine v2 models by looking for moonshine-merged-decoder.ort and configuring the model with encoder.ort and mergedDecoder.ort.
  • Deployment Script Enhancements: Updated the deployment script to make ModelScope deployment conditional on the presence of an ms_name variable and changed the username used for pushing to Hugging Face Spaces.
Changelog
  • scripts/wasm/generate-vad-asr.py
    • Added ten new Model configurations for sherpa-onnx-moonshine-v2 models (tiny-en, tiny-ja, tiny-ko, base-en, base-zh, base-ja, base-vi, base-es, base-ar, base-uk).
    • Included specific commands within each new model's configuration to move model files (encoder_model.ort, decoder_model_merged.ort, tokens.txt, LICENSE) and update the index.html file with the correct model description.
  • scripts/wasm/run-vad-asr.sh.in
    • Wrapped the ModelScope deployment logic in a conditional block, ensuring it only executes if the ms_name variable is set.
    • Updated the username from csukuangfj to csukuangfj2 in the Hugging Face push command.
  • wasm/vad-asr/app-vad-asr.js
    • Introduced a new else if condition to detect moonshine-merged-decoder.ort for Moonshine v2 models.
    • Configured the moonshine model object to use encoder.ort and mergedDecoder.ort when a Moonshine v2 model is detected.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/wasm-simd-hf-space-vad-asr.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Feb 28, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0d7d10 and 4dc8c6a.

📒 Files selected for processing (1)
  • scripts/wasm/generate-vad-asr.py

📝 Walkthrough

Walkthrough

Adds Moonshine v2 model entries and runtime detection, makes ms-related shell steps conditional, updates a GitHub Actions matrix to run more parallel jobs, and changes a Hugging Face push target URL. All changes are factual and do not alter public APIs.

Changes

Cohort / File(s) Summary
CI / Workflow
\.github/workflows/wasm-simd-hf-space-vad-asr.yaml
Expanded matrix size: total jobs from 11→15 and indices from 0–10→0–14 (no step logic changes).
Model catalog & packaging scripts
scripts/wasm/generate-vad-asr.py, scripts/wasm/run-vad-asr.sh.in
Added ~170 lines registering multiple Moonshine v2 model variants (tiny/base across languages). Wrapped ms-related operations in if ms_name guard and changed Hugging Face git push URL from csukuangfj → csukuangfj2.
WASM frontend runtime
wasm/vad-asr/app-vad-asr.js
Added detection/config for Moonshine v2 (detects moonshine-merged-decoder.ort and configures encoder + mergedDecoder paths), alongside existing Moonshine v1 handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through scripts and CI bright,

packed new Moonshine models tight,
a guarded clone, a gentler push,
WASM glimpses the merged-decoder hush,
hooray — small hops, big delight! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: building Hugging Face Spaces for Moonshine v2 with WebAssembly, which is directly reflected in the file changes (workflow, model catalog, deployment scripts, and app configuration).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Moonshine v2 models for WebAssembly deployment. The changes include updating the model generation script with new model definitions, modifying the build script to handle model-specific deployment, and updating the JavaScript application to recognize and use the new model structure. My review has identified a recurring typo in the model short names within scripts/wasm/generate-vad-asr.py and a hardcoded username in scripts/wasm/run-vad-asr.sh.in. These are medium-severity issues that should be addressed to improve maintainability and prevent potential issues with generated artifacts.

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-tiny-en-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-en",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-en",
short_name="vad-asr-mooshine-v2-tiny-en",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-tiny-en",
short_name="vad-asr-moonshine-v2-tiny-en",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-tiny-ja-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-ja",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-ja",
short_name="vad-asr-mooshine-v2-tiny-ja",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-tiny-ja",
short_name="vad-asr-moonshine-v2-tiny-ja",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-tiny-ko-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-ko",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-tiny-ko",
short_name="vad-asr-mooshine-v2-tiny-ko",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-tiny-ko",
short_name="vad-asr-moonshine-v2-tiny-ko",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-en-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-en",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-en",
short_name="vad-asr-mooshine-v2-base-en",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-en",
short_name="vad-asr-moonshine-v2-base-en",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-zh-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-zh",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-zh",
short_name="vad-asr-mooshine-v2-base-zh",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-zh",
short_name="vad-asr-moonshine-v2-base-zh",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-vi-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-vi",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-vi",
short_name="vad-asr-mooshine-v2-base-vi",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-vi",
short_name="vad-asr-moonshine-v2-base-vi",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-es-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-es",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-es",
short_name="vad-asr-mooshine-v2-base-es",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-es",
short_name="vad-asr-moonshine-v2-base-es",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-ar-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-ar",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-ar",
short_name="vad-asr-mooshine-v2-base-ar",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-ar",
short_name="vad-asr-moonshine-v2-base-ar",

Comment thread scripts/wasm/generate-vad-asr.py Outdated
model_name="sherpa-onnx-moonshine-base-uk-quantized-2026-02-27",
hf="k2-fsa/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-uk",
ms="csukuangfj/web-assembly-vad-asr-sherpa-onnx-moonshine-v2-base-uk",
short_name="vad-asr-mooshine-v2-base-uk",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the short_name. It should probably be moonshine instead of mooshine. This name is used in build scripts, so correcting it is important for consistency and to avoid potential issues with generated artifacts.

Suggested change
short_name="vad-asr-mooshine-v2-base-uk",
short_name="vad-asr-moonshine-v2-base-uk",

git add .
git commit -m "update model" || true
git push https://csukuangfj:$HF_TOKEN@huggingface.co/spaces/$hf_name main || true
git push https://csukuangfj2:$HF_TOKEN@huggingface.co/spaces/$hf_name main || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Hugging Face username csukuangfj2 is hardcoded. It's better to use an environment variable (e.g., HF_USERNAME) for this to avoid committing user-specific details and to make the script more configurable. You would then need to set this environment variable in your CI/build environment.

git push https://${HF_USERNAME}:$HF_TOKEN@huggingface.co/spaces/$hf_name main || true

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/wasm/generate-vad-asr.py (1)

101-101: Minor inconsistency: "日语" vs "日文" for Japanese.

Line 101 (tiny-ja) uses "日语" while line 169 (base-ja) uses "日文". Both mean Japanese but using different terms. Consider standardizing to one term for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/wasm/generate-vad-asr.py` at line 101, Standardize the Japanese term
used in the sed replacement lines: locate the two sed commands that replace the
model titles (the tiny-ja replacement containing "日语" and the base-ja
replacement containing "日文") and make them use the same term across both lines
(choose either "日语" or "日文" consistently), updating the replacement strings in
both sed invocations so the index.html substitutions match.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/wasm/generate-vad-asr.py`:
- Line 75: Fix the typo in each model entry where the short_name is set (e.g.,
the entries defining short_name="vad-asr-mooshine-v2-tiny-en" and the nine other
Moonshine v2 variants); replace "mooshine" with "moonshine" so short_name reads
"vad-asr-moonshine-v2-<variant>" for all listed variants (tiny-ja, tiny-ko,
base-en, base-zh, base-ja, base-vi, base-es, base-ar, base-uk, etc.) to ensure
generated artifact filenames using ${short_name} are correct.

---

Nitpick comments:
In `@scripts/wasm/generate-vad-asr.py`:
- Line 101: Standardize the Japanese term used in the sed replacement lines:
locate the two sed commands that replace the model titles (the tiny-ja
replacement containing "日语" and the base-ja replacement containing "日文") and
make them use the same term across both lines (choose either "日语" or "日文"
consistently), updating the replacement strings in both sed invocations so the
index.html substitutions match.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13ab997 and e0d7d10.

📒 Files selected for processing (4)
  • .github/workflows/wasm-simd-hf-space-vad-asr.yaml
  • scripts/wasm/generate-vad-asr.py
  • scripts/wasm/run-vad-asr.sh.in
  • wasm/vad-asr/app-vad-asr.js

Comment thread scripts/wasm/generate-vad-asr.py Outdated
@csukuangfj
csukuangfj merged commit 1934436 into k2-fsa:master Feb 28, 2026
1 check was pending
@csukuangfj
csukuangfj deleted the wasm-moonshine-v2 branch February 28, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant