Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 54 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
type: boolean
default: false

# Each platform's job builds speech, the one executable, and libspeech, and packs them with speech.h into the archive
# a release publishes, speech-<VERSION>-<platform>.zip, on every run: a pull request shows the archive a tag would
# release, and the release job publishes the same files. The checks are built to keep them compiling, and released in
# no archive.
# Each platform's job builds speech, the one executable, and libspeech, or for browsers the library in WebAssembly, and
# packs them with speech.h into the archive a release publishes, speech-<VERSION>-<platform>.zip, on every run: a pull
# request shows the archive a tag would release, and the release job publishes the same files. The checks are built to
# keep them compiling, and released in no archive.
jobs:
macos-metal:
runs-on: macos-15
Expand Down Expand Up @@ -279,6 +279,54 @@ jobs:
name: speech-linux-x64-${{ matrix.backend }}
path: ${{ env.ARCHIVE }}

# The WebAssembly build for browsers, on one thread and with threads, packed with the module, the page and the server
# that go beside it and speech.h into speech-<VERSION>-wasm.zip. emsdk at the commit of its tag pins the Emscripten it
# downloads, and its node runs the check.
wasm:
runs-on: ubuntu-22.04
env:
EMSDK_VERSION: 7.0.0
EMSDK_COMMIT: 1693ce7359fc9694f198694f902a2cc061239b86
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Emscripten
run: |
git clone --quiet https://github.com/emscripten-core/emsdk.git "$RUNNER_TEMP/emsdk"
git -C "$RUNNER_TEMP/emsdk" checkout --quiet "$EMSDK_COMMIT"
"$RUNNER_TEMP/emsdk/emsdk" install "$EMSDK_VERSION"
"$RUNNER_TEMP/emsdk/emsdk" activate "$EMSDK_VERSION"
- name: Build
run: |
source "$RUNNER_TEMP/emsdk/emsdk_env.sh"
emcmake cmake -B build-wasm -DCMAKE_BUILD_TYPE=Release
cmake --build build-wasm -j 4
emcmake cmake -B build-wasm-threads -DCMAKE_BUILD_TYPE=Release -DSPEECH_WASM_THREADS=ON
cmake --build build-wasm-threads -j 4
- name: Package
run: |
archive="speech-$(cat VERSION)-wasm.zip"
mkdir package
cp build-wasm/libspeech.js build-wasm/libspeech.wasm build-wasm-threads/libspeech-threads.js \
build-wasm-threads/libspeech-threads.wasm build-wasm/speech.mjs build-wasm/wav.mjs build-wasm/worker.mjs \
build-wasm/page.mjs build-wasm/index.html build-wasm/serve.py include/speech.h package/
(cd package && zip -q "../$archive" *)
echo "ARCHIVE=$archive" >> "$GITHUB_ENV"
# The archive as a page serves it: in a headless Chrome the page opens cross-origin isolated, and both modules
# start and give the release.
- name: Check the archive
run: |
source "$RUNNER_TEMP/emsdk/emsdk_env.sh"
mkdir unpacked
unzip -q "$ARCHIVE" -d unpacked
ls -l unpacked
CHROME=$(command -v google-chrome) node checks/smoke/wasm_browser_smoke.mjs --started unpacked "$(cat VERSION)"
- uses: actions/upload-artifact@v4
with:
name: speech-wasm
path: ${{ env.ARCHIVE }}

# install.sh as a user runs it, against the published releases, in home folders of the job's own: a first install of
# an earlier release, an update to the latest that removes it, a run that finds it installed, a build of another
# archive of the same version replaced, the line it adds to PATH once however often it runs, and an archive whose
Expand Down Expand Up @@ -360,7 +408,7 @@ jobs:

release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [macos-metal, windows-vulkan, linux]
needs: [macos-metal, windows-vulkan, linux, wasm]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -390,4 +438,4 @@ jobs:
run: |
gh release create "$GITHUB_REF_NAME" dist/*.zip dist/SHA256SUMS --repo "$GITHUB_REPOSITORY" \
--title "$GITHUB_REF_NAME" --generate-notes \
--notes "speech, speech.cpp's one executable (tts, asr, vad, diarize, enhance, talk, serve, worker, models, pull, rm, info, voice, quantize, devices and update), and the shared library libspeech with its C API, speech.h, in one archive for each of macOS arm64 (Metal), Windows x64 (Vulkan) and Linux x64 (Vulkan, and the CPU alone; glibc 2.34 or later). The README lists the model families and where their converted weights are on Hugging Face."
--notes "speech, speech.cpp's one executable (tts, asr, vad, diarize, enhance, talk, serve, worker, models, pull, rm, info, voice, quantize, devices and update), and the shared library libspeech with its C API, speech.h, in one archive for each of macOS arm64 (Metal), Windows x64 (Vulkan) and Linux x64 (Vulkan, and the CPU alone; glibc 2.34 or later), and the library in WebAssembly for web pages, with Silero VAD, in speech-<version>-wasm.zip. The README lists the model families and where their converted weights are on Hugging Face."
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ README.md and `docs/` are the documentation for users; what a developer needs is
it, `server_openai_smoke.py` the server through the official openai-python client,
`speech_cli_smoke.py` the command line against the worker, `models_smoke.py` the naming, fetching and removing of
models against a temporary model folder, and `wasm_browser_smoke.mjs` the WebAssembly build through its page in a
headless Chrome against `speech vad`. A script that needs packages outside the standard library is a uv script
headless Chrome against `speech vad`, or with `--started`, as CI checks the archive without a model, that its modules
start. A script that needs packages outside the standard library is a uv script
with its dependencies pinned in the script and in a lock file beside it.
- `reference/<model>/` holds, per model, a uv environment that pins the official code, PyTorch and the rest,
`pins.py`, which pins the checkpoints by revision, the conversion of the official weights to one GGUF file per
Expand Down
3 changes: 2 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<img src="https://img.shields.io/badge/macOS-Apple%20Silicon%20%C2%B7%20Metal-lightgrey?style=flat-square" alt="Apple Silicon の macOS で Metal を使う">
<img src="https://img.shields.io/badge/Windows-x64%20%C2%B7%20Vulkan-lightgrey?style=flat-square" alt="x64 の Windows で Vulkan を使う">
<img src="https://img.shields.io/badge/Linux-x64%20%C2%B7%20Vulkan%20or%20CPU-lightgrey?style=flat-square" alt="x64 の Linux で Vulkan か CPU を使う">
<img src="https://img.shields.io/badge/Browser-WebAssembly-lightgrey?style=flat-square" alt="ブラウザで WebAssembly として動く">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT ライセンス"></a>
</p>

Expand Down Expand Up @@ -85,7 +86,7 @@ x64 の Windows では、PowerShell で次のコマンドを実行します。
irm https://raw.githubusercontent.com/nyosegawa/speech.cpp/main/install.ps1 | iex
```

インストーラはリリースのアーカイブを SHA-256 で確かめ、`speech` をホームフォルダの下に置き、`PATH` に加えます。`speech update` を実行するか、インストーラをもう一度実行すると更新されます。Linux では、Vulkan のローダーが入っていれば Vulkan 版を、入っていなければ CPU 版をインストールします。Linux 版には glibc 2.34 以降が必要です。オプション、アンインストールの方法、各プラットフォームで必要なものは [docs/install.md](docs/install.md) にあります。Intel Mac やその他のシステムでは、[ソースからビルド](docs/install.md#build-from-source)してください。
インストーラはリリースのアーカイブを SHA-256 で確かめ、`speech` をホームフォルダの下に置き、`PATH` に加えます。`speech update` を実行するか、インストーラをもう一度実行すると更新されます。Linux では、Vulkan のローダーが入っていれば Vulkan 版を、入っていなければ CPU 版をインストールします。Linux 版には glibc 2.34 以降が必要です。オプション、アンインストールの方法、各プラットフォームで必要なものは [docs/install.md](docs/install.md) にあります。Intel Mac やその他のシステムでは、[ソースからビルド](docs/install.md#build-from-source)してください。ウェブページで使うために、各リリースには WebAssembly にしたライブラリーの `speech-<version>-wasm.zip` があり、ブラウザの中で Silero VAD を動かせます([docs/browser.md](docs/browser.md))。

## クイックスタート

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<img src="https://img.shields.io/badge/macOS-Apple%20Silicon%20%C2%B7%20Metal-lightgrey?style=flat-square" alt="macOS on Apple Silicon, with Metal">
<img src="https://img.shields.io/badge/Windows-x64%20%C2%B7%20Vulkan-lightgrey?style=flat-square" alt="Windows on x64, with Vulkan">
<img src="https://img.shields.io/badge/Linux-x64%20%C2%B7%20Vulkan%20or%20CPU-lightgrey?style=flat-square" alt="Linux on x64, with Vulkan or the CPU">
<img src="https://img.shields.io/badge/Browser-WebAssembly-lightgrey?style=flat-square" alt="Browsers, as WebAssembly">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT License"></a>
</p>

Expand Down Expand Up @@ -102,7 +103,8 @@ The installer checks the release's archive against its SHA-256, puts `speech` un
`PATH`. `speech update`, or running it again, updates it. On Linux it installs the Vulkan build when the Vulkan loader
is installed, and the CPU build otherwise; the Linux builds need glibc 2.34 or later. [docs/install.md](docs/install.md)
has the options, how to uninstall, and what each platform needs. On an Intel Mac or another system, [build from
source](docs/install.md#build-from-source).
source](docs/install.md#build-from-source). For a web page, each release has the library in WebAssembly,
`speech-<version>-wasm.zip`, which runs Silero VAD inside the browser ([docs/browser.md](docs/browser.md)).

## Quick start

Expand Down
Loading
Loading