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
139 changes: 131 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
- name: README command tests
shell: bash
run: bash tests/readme-commands.sh
# Exercise the end-user launcher (download-if-missing + serve + teardown)
# against the dummy fixtures and a local http.server standing in for HF.
- name: Launcher smoke test
shell: bash
run: bash tests/launcher-smoke.sh
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
Expand All @@ -62,6 +67,8 @@ jobs:
cp -r default_voices emotion_directions dist/
mkdir -p dist/scripts
cp scripts/normalize-text.py dist/scripts/
cp scripts/start-zonos2.sh dist/start-zonos2.sh
chmod +x dist/start-zonos2.sh
tar -C dist -czf zonos2-linux-x64-cpu.tar.gz .
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -138,30 +145,105 @@ jobs:
cp -r default_voices emotion_directions dist/
mkdir -p dist/scripts
cp scripts/normalize-text.py dist/scripts/
# stamp the launcher's backend default to match this archive's build
sed 's/^GPU_DEFAULT=cpu/GPU_DEFAULT=gpu/' scripts/start-zonos2.sh > dist/start-zonos2.sh
grep -q '^GPU_DEFAULT=gpu' dist/start-zonos2.sh || { echo "GPU stamp failed"; exit 1; }
chmod +x dist/start-zonos2.sh
tar -C dist -czf zonos2-linux-x64-vulkan.tar.gz .
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: zonos2-linux-x64-vulkan
path: zonos2-linux-x64-vulkan.tar.gz

# -------------------------------------------------------- Linux desktop app
# zonos2-app (saucer webview shell). Needs ubuntu-24.04: saucer hard-requires
# GTK4 >= 4.12 + a C++23 compiler (gcc-14), both beyond the 22.04 jobs above,
# which stay on 22.04 to keep the glibc baseline of the CLI artifacts.
linux-app:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install desktop + Vulkan deps
run: |
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc >/dev/null
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list https://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list
sudo apt-get update
sudo apt-get install -y vulkan-sdk gcc-14 g++-14 \
libgtk-4-dev libwebkitgtk-6.0-dev libadwaita-1-dev libjson-glib-dev
- name: Resolve ggml submodule rev
id: ggml
run: echo "sha=$(git rev-parse HEAD:ggml)" >> "$GITHUB_OUTPUT"
- uses: hendrikmuhs/[email protected]
with:
key: linux-app
# Same shader-gen build-tree cache rationale as the linux-vulkan job.
- name: Cache build tree
uses: actions/cache@v4
with:
path: build
key: linux-app-build-${{ steps.ggml.outputs.sha }}-${{ hashFiles('src/**', 'CMakeLists.txt') }}
restore-keys: |
linux-app-build-${{ steps.ggml.outputs.sha }}-
- name: Configure
run: >
cmake -B build -DCMAKE_BUILD_TYPE=Release -DZONOS2_APP=ON -DGGML_VULKAN=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build -j"$(nproc)"
- name: Smoke test
shell: bash
run: |
bin=$(find build -name zonos2-app -type f | head -1)
out=$("$bin" --help 2>&1 || true)
echo "$out" | grep -q "usage:" || { echo "app smoke failed:"; echo "$out"; exit 1; }
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
mkdir -p dist
find build -name 'zonos2-app' -type f -exec cp {} dist/ \;
cp -r web dist/web
cp assets/app/zonos2.desktop assets/app/zonos2.png dist/
tar -C dist -czf zonos2-linux-x64-app.tar.gz .
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: zonos2-linux-x64-app
path: zonos2-linux-x64-app.tar.gz

# ------------------------------------------------------------- macOS Metal
# macos-14 is Apple Silicon (arm64); Metal is enabled by default in ggml.
# macos-15 is Apple Silicon (arm64); Metal is enabled by default in ggml.
# (15 rather than 14 because zonos2-app's saucer dependency needs AppleClang 17
# / Xcode >= 16.3.)
macos-metal:
runs-on: macos-14
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: hendrikmuhs/[email protected]
with:
key: macos-metal
- name: Select Xcode >= 16.3 (saucer needs AppleClang 17)
run: |
sudo xcode-select -s "$(ls -d /Applications/Xcode_16.*.app /Applications/Xcode_2*.app 2>/dev/null | sort -V | tail -1)/Contents/Developer"
clang++ --version
- name: Configure
run: >
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
cmake -B build -DCMAKE_BUILD_TYPE=Release -DZONOS2_APP=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build -j"$(sysctl -n hw.ncpu)"
- name: App smoke test
shell: bash
run: |
bin=$(find build -path '*Zonos2.app/Contents/MacOS/*' -type f -perm +111 | head -1)
out=$("$bin" --help 2>&1 || true)
echo "$out" | grep -q "usage:" || { echo "app smoke failed:"; echo "$out"; exit 1; }
- name: Smoke test
shell: bash
run: |
Expand All @@ -186,6 +268,11 @@ jobs:
- name: README command tests
shell: bash
run: bash tests/readme-commands.sh
# Exercise the end-user launcher (download-if-missing + serve + teardown)
# against the dummy fixtures and a local http.server standing in for HF.
- name: Launcher smoke test
shell: bash
run: bash tests/launcher-smoke.sh
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
Expand All @@ -196,12 +283,27 @@ jobs:
cp -r default_voices emotion_directions dist/
mkdir -p dist/scripts
cp scripts/normalize-text.py dist/scripts/
# stamp the launcher's backend default to match this archive's build;
# ship it twice: .command for Finder double-click, .sh for the terminal
sed 's/^GPU_DEFAULT=cpu/GPU_DEFAULT=gpu/' scripts/start-zonos2.sh > dist/start-zonos2.sh
grep -q '^GPU_DEFAULT=gpu' dist/start-zonos2.sh || { echo "GPU stamp failed"; exit 1; }
cp dist/start-zonos2.sh dist/start-zonos2.command
chmod +x dist/start-zonos2.sh dist/start-zonos2.command
tar -C dist -czf zonos2-macos-arm64-metal.tar.gz .
# Desktop app bundle, ad-hoc signed (users right-click > Open past Gatekeeper).
app=$(find build -name 'Zonos2.app' -type d | head -1)
codesign --force --deep -s - "$app"
ditto -c -k --keepParent "$app" zonos2-macos-arm64-app.zip
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: zonos2-macos-arm64-metal
path: zonos2-macos-arm64-metal.tar.gz
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: zonos2-macos-arm64-app
path: zonos2-macos-arm64-app.zip

# ----------------------------------------------------------- Windows Vulkan
# MSVC build; relies on the _WIN32 file-IO shim in src/compat.h.
Expand Down Expand Up @@ -260,10 +362,16 @@ jobs:
win-vulkan-build-${{ steps.ggml.outputs.sha }}-
- name: Configure
run: >
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_VULKAN=ON -DBUILD_SHARED_LIBS=OFF
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DZONOS2_APP=ON -DGGML_VULKAN=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build -j
- name: App smoke test
shell: bash
run: |
bin=$(find build -name zonos2-app.exe -type f | head -1)
out=$("$bin" --help 2>&1 || true)
echo "$out" | grep -q "usage:" || { echo "app smoke failed:"; echo "$out"; exit 1; }
- name: Smoke test
shell: bash
run: |
Expand All @@ -288,26 +396,41 @@ jobs:
- name: README command tests
shell: bash
run: bash tests/readme-commands.sh
# The launcher can't run end-to-end here (no bash trap semantics; see
# tests/launcher-smoke.sh for the Linux/macOS coverage), but a parse check
# catches ps1 syntax errors before they ship in a release archive.
- name: Launcher parse check
shell: pwsh
run: |
$errs = $null
[System.Management.Automation.Language.Parser]::ParseFile("$PWD\scripts\start-zonos2.ps1", [ref]$null, [ref]$errs) | Out-Null
if ($errs) { $errs; throw "start-zonos2.ps1 has parse errors" }
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
mkdir -p dist
find build \( -name 'zonos2-cli.exe' -o -name 'spk-encoder-cli.exe' -o -name 'dac-cli.exe' -o -name 'quantize-cli.exe' -o -name 'zonos2-server.exe' \) -type f -exec cp {} dist/ \;
find build \( -name 'zonos2-cli.exe' -o -name 'spk-encoder-cli.exe' -o -name 'dac-cli.exe' -o -name 'quantize-cli.exe' -o -name 'zonos2-server.exe' -o -name 'zonos2-app.exe' \) -type f -exec cp {} dist/ \;
cp -r web dist/web
cp -r default_voices emotion_directions dist/
mkdir -p dist/scripts
cp scripts/normalize-text.py dist/scripts/
tar -C dist -czf zonos2-windows-x64-vulkan.tar.gz .
# stamp the launcher's backend default to match this archive's build
sed "s/^\\\$GPU_DEFAULT = 'cpu'/\$GPU_DEFAULT = 'gpu'/" scripts/start-zonos2.ps1 > dist/start-zonos2.ps1
grep -q "^\\\$GPU_DEFAULT = 'gpu'" dist/start-zonos2.ps1 || { echo "GPU stamp failed"; exit 1; }
cp scripts/start-zonos2.bat dist/start-zonos2.bat
# zip, not tar.gz: Explorer extracts it natively and (unlike tar) keeps
# the Mark-of-the-Web flow the README's SmartScreen guidance describes
(cd dist && 7z a -tzip ../zonos2-windows-x64-vulkan.zip . > /dev/null)
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: zonos2-windows-x64-vulkan
path: zonos2-windows-x64-vulkan.tar.gz
path: zonos2-windows-x64-vulkan.zip

# ------------------------------------------------- Release (version tags only)
release:
needs: [linux-cpu, linux-vulkan, macos-metal, windows-vulkan]
needs: [linux-cpu, linux-vulkan, linux-app, macos-metal, windows-vulkan]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ __pycache__/
.venv-tts-norm/
_pydeps/

# zonos2-app (saucer) runtime state — cookies/localStorage SQLite db, not source
.saucer

# Personal Claude Code instructions (private)
CLAUDE.local.md
76 changes: 76 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
endif()

# --- zonos2-app (desktop shell) opt-in. Declared here, before add_subdirectory(ggml),
# specifically so the Apple Objective-C / -C++ languages it needs are enabled in
# THIS root scope first. saucer's WKWebView backend + saucer-embed inject .m/.mm
# sources into the top-level zonos2-app target; ggml's Metal backend also enables
# OBJC — but inside ggml's own subdirectory scope. Whichever scope enables a
# language *first* is the only one that gets CMAKE_<LANG>_COMPILE_OBJECT, so if
# ggml (a subdir) wins the race the top-level target is left without the rule and
# CMake dies at generate with "CMAKE_OBJC_COMPILE_OBJECT not set". Enabling both
# here, pre-ggml, makes the root scope the first enabler and the rules propagate
# down to ggml and up to zonos2-app alike. C++23 toolchain still required (README). ---
option(ZONOS2_APP "Build the zonos2-app desktop shell (requires a C++23 toolchain, see README)" OFF)
if (ZONOS2_APP AND APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif()

# --- CUDA target (H100 = sm_90). Enable with -DGGML_CUDA=ON ---
if (GGML_CUDA)
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
Expand Down Expand Up @@ -81,6 +97,11 @@ add_executable(quantize-cli src/quantize.cpp)
target_include_directories(quantize-cli PRIVATE src ggml/include)
target_link_libraries(quantize-cli PRIVATE ggml)

# --- gguf -> gguf MoE expert pruner (drops low-MSAN experts per layer) ---
add_executable(prune-cli src/prune.cpp)
target_include_directories(prune-cli PRIVATE src ggml/include)
target_link_libraries(prune-cli PRIVATE ggml)

# --- perplexity / KL-divergence eval for quantized backbones (scoring only, no DAC) ---
add_executable(zonos2-perplexity src/perplexity.cpp)
target_include_directories(zonos2-perplexity PRIVATE src ggml/include)
Expand All @@ -95,3 +116,58 @@ target_link_libraries(zonos2-server PRIVATE zonos2 ggml Threads::Threads)
if (WIN32)
target_link_libraries(zonos2-server PRIVATE ws2_32)
endif()

# --- Desktop app: the server embedded in a native webview window (saucer). Opt-in
# because saucer needs a much newer toolchain than the rest of the project:
# CMake >= 3.25, C++23 (GCC >= 14 / Clang >= 20 / AppleClang >= 17 / MSVC >= 19.44),
# and on Linux GTK4 >= 4.12 + WebKitGTK-6.0 + libadwaita + json-glib dev packages.
# Everything else in this file keeps building with the C++17 / CMake 3.18 floor. ---
# ZONOS2_APP is declared (and its Apple languages enabled) near the top of this file,
# before add_subdirectory(ggml); see the comment there for why the ordering matters.
if (ZONOS2_APP)
if (CMAKE_VERSION VERSION_LESS 3.31)
# saucer core says 3.25, but its saucer-embed dependency uses policy CMP0174 (3.31).
message(FATAL_ERROR "ZONOS2_APP requires CMake >= 3.31 (saucer); this is CMake ${CMAKE_VERSION}")
endif()

include(FetchContent)
FetchContent_Declare(saucer
GIT_REPOSITORY https://github.com/saucer/saucer
GIT_TAG v8.0.5)
FetchContent_Declare(saucer-desktop # native file pickers (saucer module)
GIT_REPOSITORY https://github.com/saucer/desktop
GIT_TAG v4.1.0)
FetchContent_MakeAvailable(saucer saucer-desktop)

add_executable(zonos2-app src/app.cpp src/server.cpp src/dac.cpp src/spk-encoder.cpp)
target_compile_definitions(zonos2-app PRIVATE ZONOS2_APP_EMBED) # server.cpp: no main()
target_compile_features(zonos2-app PRIVATE cxx_std_23)
target_include_directories(zonos2-app PRIVATE src vendor ggml/include)
target_link_libraries(zonos2-app PRIVATE zonos2 ggml saucer::saucer saucer::desktop Threads::Threads)

if (WIN32)
# GUI subsystem (no console window) with the icon resource; saucer has no
# WinMain, so keep the standard main() as the entry point.
target_sources(zonos2-app PRIVATE assets/app/zonos2.rc)
set_target_properties(zonos2-app PROPERTIES WIN32_EXECUTABLE TRUE)
target_link_libraries(zonos2-app PRIVATE ws2_32)
if (MSVC)
target_link_options(zonos2-app PRIVATE "/ENTRY:mainCRTStartup")
endif()
elseif (APPLE)
# Zonos2.app bundle; the web UI and icon ship inside Contents/Resources
# (app.cpp resolves ../Resources/tts_ui.html relative to the executable).
set(ZONOS2_APP_RESOURCES web/tts_ui.html assets/app/zonos2.icns assets/app/zonos2.png)
target_sources(zonos2-app PRIVATE ${ZONOS2_APP_RESOURCES})
set_source_files_properties(${ZONOS2_APP_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(zonos2-app PROPERTIES
OUTPUT_NAME Zonos2
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/assets/app/Info.plist.in
MACOSX_BUNDLE_BUNDLE_NAME Zonos2
MACOSX_BUNDLE_GUI_IDENTIFIER cpp.zonos2.app
MACOSX_BUNDLE_BUNDLE_VERSION 1.0
MACOSX_BUNDLE_SHORT_VERSION_STRING 1.0
MACOSX_BUNDLE_ICON_FILE zonos2.icns)
endif()
endif()
Loading
Loading