mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-04 01:18:16 +00:00
feat(gguf): bundle omnivoice.cpp tts-server so resident mode works in releases
Move the omnivoice.cpp pin (desktop and mobile) to 040c8b3, the commit that adds the tts-server target and voice registry the resident mode needs. Build, checksum, upload and package tts-server-<platform> beside omnivoice-tts-<platform> on every desktop platform, fail the build and packaging when it is missing, and log once why resident mode fell back to the per-request binary. Refs #3654
This commit is contained in:
1 parent
88397032c2
commit
291d9fa7c0
32 files changed
+246
-96
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Build the `omnivoice-tts` C++ runtime binary (Phase 4 Plan 04-01, GGUF-03).
|
||||
# Build the `omnivoice-tts` C++ runtime binary (plus the `tts-server` resident server, #3654) (Phase 4 Plan 04-01, GGUF-03).
|
||||
#
|
||||
# The runtime is PINNED to a commit SHA in
|
||||
# `backend/engines/omnivoice_gguf/quant_map.json` (`_meta.runtime_commit_sha`),
|
||||
@@ -156,6 +156,19 @@ jobs:
|
||||
else
|
||||
echo "::error::$PLATFORM built without the ggml-vulkan module"; exit 1
|
||||
fi
|
||||
# The resident server (#3654) is built by the same cmake run; without it
|
||||
# the opt-in resident mode silently never engages in the installers.
|
||||
- name: Check the resident server was built and checksummed
|
||||
shell: bash
|
||||
env:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
run: |
|
||||
ext=""
|
||||
if [[ "$PLATFORM" == windows-* ]]; then ext=".exe"; fi
|
||||
for name in "omnivoice-tts-$PLATFORM$ext" "tts-server-$PLATFORM$ext"; do
|
||||
test -s "bin/$name" || { echo "::error::$PLATFORM did not build $name"; exit 1; }
|
||||
grep -q " $name\$" bin/checksums.sha256 || { echo "::error::checksums.sha256 does not list $name"; exit 1; }
|
||||
done
|
||||
- name: Upload binary artifact
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
@@ -163,6 +176,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
bin/omnivoice-tts-${{ matrix.platform }}*
|
||||
bin/tts-server-${{ matrix.platform }}*
|
||||
bin/libggml*
|
||||
bin/ggml*.dll
|
||||
bin/vcruntime140*.dll
|
||||
|
||||
@@ -31,7 +31,7 @@ The `_meta` block of `quant_map.json` carries the pins:
|
||||
used to download quant files. Currently `361609388ae572a820d085185bbbe2a2aac4b30e`.
|
||||
- `runtime_commit_sha` — `omnivoice.cpp` master HEAD that the bundled
|
||||
`bin/omnivoice-tts-<platform>` binaries were built from. Currently
|
||||
`886fc079838ca7400cb2b42b36e2a65aa1daabe8`.
|
||||
`040c8b344d8c670ce1475194751d119b5ef82c78`.
|
||||
|
||||
Both SHAs are mirrored in the SPIKE-01 ADR so the engine code and the
|
||||
decision doc cannot drift.
|
||||
|
||||
@@ -1329,8 +1329,9 @@ def _make_backend_class():
|
||||
with self._resident.lock:
|
||||
self._resident.stop()
|
||||
return None
|
||||
ok, _why = resident.server_status()
|
||||
ok, why = resident.server_status()
|
||||
if not ok:
|
||||
resident.log_unavailable_once(why)
|
||||
return None
|
||||
reason = resident.spawn_only_reason(kw, has_transcript=bool(transcript))
|
||||
if reason:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"source_model": "Serveurperso/OmniVoice-GGUF",
|
||||
"source_commit_sha": "361609388ae572a820d085185bbbe2a2aac4b30e",
|
||||
"runtime": "omnivoice.cpp",
|
||||
"runtime_commit_sha": "886fc079838ca7400cb2b42b36e2a65aa1daabe8",
|
||||
"runtime_commit_sha": "040c8b344d8c670ce1475194751d119b5ef82c78",
|
||||
"doc": "Pinned at Phase 4 Plan 04-01 (2026-05-20). source_commit_sha is the HF repo revision; runtime_commit_sha is the omnivoice.cpp master HEAD used to build bin/omnivoice-tts-* binaries. Both SHAs are also recorded in docs/adr/SPIKE-01-gguf.md so the engine code and the ADR cannot drift."
|
||||
},
|
||||
"high-vram": {
|
||||
|
||||
@@ -133,6 +133,16 @@ def _verify_server_binary(path: Path) -> tuple[bool, str]:
|
||||
return True, "ready"
|
||||
|
||||
|
||||
_UNAVAILABLE_LOGGED: set[str] = set()
|
||||
|
||||
|
||||
def log_unavailable_once(why: str) -> None:
|
||||
"""Say once per reason why the opt-in resident mode fell back to the CLI."""
|
||||
if why not in _UNAVAILABLE_LOGGED:
|
||||
_UNAVAILABLE_LOGGED.add(why)
|
||||
logger.info("OmniVoice GGUF resident mode is on but unavailable; using the per-request runtime: %s", why)
|
||||
|
||||
|
||||
def resident_enabled() -> bool:
|
||||
"""Env ``OMNIVOICE_GGUF_RESIDENT`` > prefs.json > off. Read per call.
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ local backend). Today:
|
||||
| `omnivoice-tts-linux-x86_64` | same | Linux (x86_64) |
|
||||
| `omnivoice-tts-linux-aarch64` | same | Linux ARM64 — Apple Silicon under Asahi; built with GGML Vulkan where the toolchain supports it, so the Honeykrisp driver can accelerate generation |
|
||||
| `omnivoice-tts-windows-x86_64.exe` | same | Windows |
|
||||
| `tts-server-<platform>[.exe]` | same | Resident server for the opt-in "keep the GGUF engine loaded" mode (#3654); built beside `omnivoice-tts-*` for each platform above and listed in the manifest |
|
||||
| `checksums.sha256` | computed by `scripts/build-omnivoice-tts.sh` | SHA-256 manifest — verified by `VoiceStudioGGUFBackend.is_available()` |
|
||||
|
||||
The pinned commit SHA for `omnivoice.cpp` lives in
|
||||
|
||||
+4
-1
@@ -302,7 +302,10 @@ Every direct desktop installer except Intel macOS ships the OmniVoice GGUF
|
||||
runtime under `resources/bin/` (#2780). `electron-release.yml` and the
|
||||
packaging rehearsal call `build-omnivoice-tts.yml` (`desktop: true`) and stage
|
||||
each platform's artifact into `electron/build/omnivoice-tts/`; Windows ARM64
|
||||
ships the x64 build. Signing rewrites the binary, so the build refreshes
|
||||
ships the x64 build. Each platform ships `tts-server-<platform>` (the opt-in resident server,
|
||||
#3654) next to `omnivoice-tts-<platform>`; the build, the staging step and
|
||||
`packaging-contract.mjs` all fail if it is missing or absent from the manifest.
|
||||
Signing rewrites the binaries, so the build refreshes
|
||||
`bin/checksums.sha256` after signing (`electron/omnivoice-tts-bundle.mjs`; on
|
||||
macOS before the bundle is sealed). `packaging-contract.mjs` fails a release
|
||||
whose installer lacks the runtime, whose manifest no longer matches the shipped
|
||||
|
||||
@@ -41,7 +41,7 @@ The integration shape is `VoiceStudioGGUFBackend(TTSBackend)` wrapping Phase 2's
|
||||
### Pinned SHAs (filled in Wave 1 by Task 1)
|
||||
|
||||
- `Serveurperso/OmniVoice-GGUF` HuggingFace repo revision SHA: `361609388ae572a820d085185bbbe2a2aac4b30e` (resolved 2026-05-20 via `curl https://huggingface.co/api/models/Serveurperso/OmniVoice-GGUF`; lastModified `2026-04-30T13:39:10.000Z`)
|
||||
- `ServeurpersoCom/omnivoice.cpp` master HEAD SHA: `886fc079838ca7400cb2b42b36e2a65aa1daabe8` (resolved 2026-05-20 via `curl https://api.github.com/repos/ServeurpersoCom/omnivoice.cpp/commits/master`; commit `2026-05-17T12:41:06Z` — "cmake: scope /utf-8 to C and C++ so nvcc does not treat it as an input file")
|
||||
- `ServeurpersoCom/omnivoice.cpp` master HEAD SHA: `040c8b344d8c670ce1475194751d119b5ef82c78` (moved from `886fc079838ca7400cb2b42b36e2a65aa1daabe8` in November 2026 for the resident `tts-server` target and voice registry, #3654; commit `2026-09-05T07:06:45Z` — "server: add a voice registry and per request language")
|
||||
|
||||
Both SHAs are mirrored in `backend/engines/omnivoice_gguf/quant_map.json` `_meta` block so the engine code and the ADR cannot drift apart.
|
||||
|
||||
@@ -60,7 +60,7 @@ Both SHAs are mirrored in `backend/engines/omnivoice_gguf/quant_map.json` `_meta
|
||||
- `omnivoice.cpp` README does not publish a standalone `buildmetal.sh` script; Apple Silicon Metal is built directly via `cmake -DGGML_METAL=ON` (#2105).
|
||||
|
||||
**Mitigations:**
|
||||
- Pin `omnivoice.cpp` by commit SHA (`886fc079838ca7400cb2b42b36e2a65aa1daabe8`); rebuild from pinned SHA in CI for all 4 target platforms.
|
||||
- Pin `omnivoice.cpp` by commit SHA (`040c8b344d8c670ce1475194751d119b5ef82c78`); rebuild from pinned SHA in CI for all 4 target platforms.
|
||||
- Pin every quant file by commit SHA in `quant_map.json` (`361609388ae572a820d085185bbbe2a2aac4b30e`); shippable JSON so the table can update without an app release.
|
||||
- In-process `VoiceStudioBackend` remains as fallback if any GGUF step fails (probe, download, load, generate).
|
||||
- macOS Apple Silicon Metal build is verified via `cmake -DGGML_METAL=ON` (#2105); in-process `VoiceStudioBackend` remains available as general fallback.
|
||||
@@ -73,6 +73,6 @@ Both SHAs are mirrored in `backend/engines/omnivoice_gguf/quant_map.json` `_meta
|
||||
- https://huggingface.co/Serveurperso/OmniVoice-GGUF (verified 2026-05-18 / re-verified 2026-05-20)
|
||||
- https://huggingface.co/api/models/Serveurperso/OmniVoice-GGUF (SHA `361609388ae572a820d085185bbbe2a2aac4b30e`, 2026-05-20)
|
||||
- https://github.com/ServeurpersoCom/omnivoice.cpp (verified 2026-05-18 / re-verified 2026-05-20)
|
||||
- https://api.github.com/repos/ServeurpersoCom/omnivoice.cpp/commits/master (SHA `886fc079838ca7400cb2b42b36e2a65aa1daabe8`, 2026-05-20)
|
||||
- https://api.github.com/repos/ServeurpersoCom/omnivoice.cpp/commits/040c8b344d8c670ce1475194751d119b5ef82c78 (current pin; initial pin was `886fc079838ca7400cb2b42b36e2a65aa1daabe8`, 2026-05-20)
|
||||
- https://huggingface.co/k2-fsa/OmniVoice (upstream; separate code/weight terms)
|
||||
- `backend/services/tts_backend.py` (existing `VoiceStudioBackend` reference)
|
||||
@@ -309,10 +309,10 @@ Before reporting ready, the engine:
|
||||
## Resident server
|
||||
|
||||
Each generation normally spawns `omnivoice-tts`, which reloads the model
|
||||
every time (a few seconds per request, whatever the text length). When the
|
||||
build also bundles omnivoice.cpp's `tts-server` as
|
||||
every time (a few seconds per request, whatever the text length). The
|
||||
desktop installers bundle omnivoice.cpp's `tts-server` as
|
||||
`bin/tts-server-<platform>` (next to `omnivoice-tts-<platform>`, same
|
||||
integrity rules), you can opt in to keeping one server per loaded quant
|
||||
integrity rules), and you can opt in to keeping one server per loaded quant
|
||||
running instead, so later requests skip the reload
|
||||
([#3654](https://github.com/debpalash/VoiceStudio/issues/3654)). It is off
|
||||
by default.
|
||||
@@ -337,7 +337,9 @@ by default.
|
||||
Turn it on in **Settings → Performance → Keep the GGUF engine loaded
|
||||
between requests** (shown only when the server is bundled), or with
|
||||
`OMNIVOICE_GGUF_RESIDENT=1`; `0` keeps it off and overrides Settings.
|
||||
Without a bundled server, nothing changes.
|
||||
Without a usable server binary (a source build that lacks it, a failed
|
||||
integrity check), nothing changes: requests use the per-request binary and the
|
||||
log says why once.
|
||||
|
||||
### Before making this the default
|
||||
|
||||
|
||||
@@ -49,18 +49,34 @@ export function omnivoiceTtsBinaryName(slug) {
|
||||
return `omnivoice-tts-${slug}${slug.startsWith('windows') ? '.exe' : ''}`;
|
||||
}
|
||||
|
||||
/** The resident server (#3654) the backend looks for beside the CLI. */
|
||||
export function omnivoiceTtsServerName(slug) {
|
||||
return `tts-server-${slug}${slug.startsWith('windows') ? '.exe' : ''}`;
|
||||
}
|
||||
|
||||
function stagedFiles(dir) {
|
||||
if (!existsSync(dir)) return [];
|
||||
return readdirSync(dir).filter((name) => statSync(join(dir, name)).isFile());
|
||||
}
|
||||
|
||||
/** extraResources entry for a staged runtime; empty when nothing was staged. */
|
||||
/**
|
||||
* extraResources entry for a staged runtime; empty when nothing was staged.
|
||||
* A staged runtime must carry the resident server too: a build whose pin
|
||||
* predates it would otherwise ship a runtime on which resident mode can never
|
||||
* engage, so packaging fails instead.
|
||||
*/
|
||||
export function omnivoiceTtsResources(dir = OMNIVOICE_TTS_STAGING_DIR) {
|
||||
const files = stagedFiles(dir);
|
||||
return files.some((name) => name.startsWith('omnivoice-tts-')) &&
|
||||
files.includes(OMNIVOICE_TTS_MANIFEST)
|
||||
? [{ from: dir, to: OMNIVOICE_TTS_RESOURCE_DIR, filter: ['**/*'] }]
|
||||
: [];
|
||||
const cli = files.filter((name) => name.startsWith('omnivoice-tts-'));
|
||||
if (!cli.length || !files.includes(OMNIVOICE_TTS_MANIFEST)) return [];
|
||||
const manifest = readManifest(join(dir, OMNIVOICE_TTS_MANIFEST));
|
||||
for (const name of cli) {
|
||||
const server = name.replace(/^omnivoice-tts-/, 'tts-server-');
|
||||
if (!files.includes(server) || !manifest.has(server)) {
|
||||
throw new Error(`Staged GGUF runtime is missing the resident server ${server} (or its ${OMNIVOICE_TTS_MANIFEST} entry)`);
|
||||
}
|
||||
}
|
||||
return [{ from: dir, to: OMNIVOICE_TTS_RESOURCE_DIR, filter: ['**/*'] }];
|
||||
}
|
||||
|
||||
export function sha256File(path) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
manifestMismatches,
|
||||
omnivoiceTtsBinaryName,
|
||||
omnivoiceTtsResources,
|
||||
omnivoiceTtsServerName,
|
||||
omnivoiceTtsSlug,
|
||||
rewriteManifest,
|
||||
sha256File,
|
||||
@@ -43,7 +44,11 @@ test('maps each installer target to the slug the backend resolves (#2780)', () =
|
||||
|
||||
test('packages a staged runtime under resources/bin and nothing otherwise', () => {
|
||||
assert.deepEqual(omnivoiceTtsResources(join(tmpdir(), 'missing-omnivoice-tts')), []);
|
||||
const dir = stage({ 'omnivoice-tts-linux-x86_64': 'rt', 'libggml.so': 'lib' });
|
||||
const dir = stage({
|
||||
'omnivoice-tts-linux-x86_64': 'rt',
|
||||
'tts-server-linux-x86_64': 'srv',
|
||||
'libggml.so': 'lib',
|
||||
});
|
||||
assert.deepEqual(omnivoiceTtsResources(dir), [{ from: dir, to: 'bin', filter: ['**/*'] }]);
|
||||
});
|
||||
|
||||
@@ -134,3 +139,19 @@ test('default signing skips the pre-signed runtime and keeps other ignores', asy
|
||||
assert(forwarded.opts.ignore('/x/driver.kext'));
|
||||
assert(!forwarded.opts.ignore(join(app, 'Contents', 'MacOS', 'VoiceStudio')));
|
||||
});
|
||||
|
||||
test('refuses to package a runtime without its resident tts-server (#3654)', () => {
|
||||
const missing = stage({ 'omnivoice-tts-linux-x86_64': 'rt', 'libggml.so': 'lib' });
|
||||
assert.throws(() => omnivoiceTtsResources(missing), /missing the resident server tts-server-linux-x86_64/);
|
||||
// Present on disk but not covered by the manifest is refused too.
|
||||
const unlisted = stage({ 'omnivoice-tts-linux-x86_64': 'rt' });
|
||||
writeFileSync(join(unlisted, 'tts-server-linux-x86_64'), 'srv');
|
||||
assert.throws(() => omnivoiceTtsResources(unlisted), /missing the resident server/);
|
||||
const complete = stage({
|
||||
'omnivoice-tts-windows-x86_64.exe': 'rt',
|
||||
'tts-server-windows-x86_64.exe': 'srv',
|
||||
});
|
||||
assert.equal(omnivoiceTtsResources(complete).length, 1);
|
||||
assert.equal(omnivoiceTtsServerName('windows-x86_64'), 'tts-server-windows-x86_64.exe');
|
||||
assert.equal(omnivoiceTtsServerName('darwin-arm64'), 'tts-server-darwin-arm64');
|
||||
});
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
OMNIVOICE_TTS_RESOURCE_DIR,
|
||||
manifestMismatches,
|
||||
omnivoiceTtsBinaryName,
|
||||
omnivoiceTtsServerName,
|
||||
omnivoiceTtsSlug,
|
||||
readManifest,
|
||||
} from '../omnivoice-tts-bundle.mjs';
|
||||
@@ -275,6 +276,7 @@ if (omnivoiceTtsPlatform) {
|
||||
const runtime = config.extraResources.find((item) => item.to === OMNIVOICE_TTS_RESOURCE_DIR);
|
||||
assert(runtime, 'Release builds package the OmniVoice GGUF runtime');
|
||||
const binary = omnivoiceTtsBinaryName(omnivoiceTtsPlatform);
|
||||
const server = omnivoiceTtsServerName(omnivoiceTtsPlatform);
|
||||
const dirs = [['Staged', runtime.from]];
|
||||
if (artifactRequested) {
|
||||
dirs.push(['Packaged', resolve(artifactResources, OMNIVOICE_TTS_RESOURCE_DIR)]);
|
||||
@@ -282,20 +284,31 @@ if (omnivoiceTtsPlatform) {
|
||||
for (const [label, dir] of dirs) {
|
||||
const file = resolve(dir, binary);
|
||||
assert(existsSync(file) && statSync(file).size > 0, `${label} GGUF runtime: ${binary}`);
|
||||
const serverFile = resolve(dir, server);
|
||||
assert(
|
||||
readManifest(resolve(dir, OMNIVOICE_TTS_MANIFEST)).has(binary),
|
||||
`${label} ${OMNIVOICE_TTS_MANIFEST} covers ${binary}`,
|
||||
existsSync(serverFile) && statSync(serverFile).size > 0,
|
||||
`${label} GGUF resident server: ${server}`,
|
||||
);
|
||||
for (const name of [binary, server]) {
|
||||
assert(
|
||||
readManifest(resolve(dir, OMNIVOICE_TTS_MANIFEST)).has(name),
|
||||
`${label} ${OMNIVOICE_TTS_MANIFEST} covers ${name}`,
|
||||
);
|
||||
}
|
||||
assert.deepEqual(manifestMismatches(dir), [], `${label} GGUF runtime matches its manifest`);
|
||||
}
|
||||
if (artifactRequested && process.platform !== 'win32') {
|
||||
const packaged = resolve(artifactResources, OMNIVOICE_TTS_RESOURCE_DIR, binary);
|
||||
assert(statSync(packaged).mode & 0o111, 'Packaged GGUF runtime is executable');
|
||||
for (const name of [binary, server]) {
|
||||
const packaged = resolve(artifactResources, OMNIVOICE_TTS_RESOURCE_DIR, name);
|
||||
assert(statSync(packaged).mode & 0o111, `Packaged ${name} is executable`);
|
||||
}
|
||||
}
|
||||
if (artifactRequested && process.platform === 'darwin') {
|
||||
const packaged = resolve(artifactResources, OMNIVOICE_TTS_RESOURCE_DIR, binary);
|
||||
const verify = spawnSync('codesign', ['--verify', '--strict', packaged], { encoding: 'utf8' });
|
||||
assert.equal(verify.status, 0, `Packaged GGUF runtime is signed: ${verify.stderr}`);
|
||||
for (const name of [binary, server]) {
|
||||
const packaged = resolve(artifactResources, OMNIVOICE_TTS_RESOURCE_DIR, name);
|
||||
const verify = spawnSync('codesign', ['--verify', '--strict', packaged], { encoding: 'utf8' });
|
||||
assert.equal(verify.status, 0, `Packaged ${name} is signed: ${verify.stderr}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.equal(
|
||||
|
||||
@@ -472,8 +472,8 @@
|
||||
# The rev must equal quant_map.json's runtime_commit_sha (asserted
|
||||
# below); the ggml rev is that commit's submodule gitlink. When the pin
|
||||
# moves, update both revs and both hashes.
|
||||
omnivoiceRuntimeRev = "886fc079838ca7400cb2b42b36e2a65aa1daabe8";
|
||||
omnivoiceGgmlRev = "f3bc6505c4e2ede83a193e0fb4695938ff3804fd";
|
||||
omnivoiceRuntimeRev = "040c8b344d8c670ce1475194751d119b5ef82c78";
|
||||
omnivoiceGgmlRev = "d5152bf4348453068aa8de0d479caef40a613b9d";
|
||||
pinnedRuntimeRev =
|
||||
(lib.importJSON ./backend/engines/omnivoice_gguf/quant_map.json)._meta.runtime_commit_sha;
|
||||
|
||||
@@ -489,7 +489,7 @@
|
||||
owner = "ServeurpersoCom";
|
||||
repo = "ggml";
|
||||
rev = omnivoiceGgmlRev;
|
||||
hash = "sha256-C3pmL0NFFHTlnfeRWzS5EVz1bDW3cPO5Q6CSLXnLP3M=";
|
||||
hash = "sha256-qRyucqwOppbd0ZjjrX48Bbdh9yyljYHuUwk3sQFXLnU=";
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
@@ -500,7 +500,7 @@
|
||||
owner = "ServeurpersoCom";
|
||||
repo = "omnivoice.cpp";
|
||||
rev = omnivoiceRuntimeRev;
|
||||
hash = "sha256-apD4EVVNiuCC11iTP4dtFaMOLlEi86102WSDBx6ac/g=";
|
||||
hash = "sha256-9XE5WZo55hB4HCXaYV1FknOy0A0yVKqurgfVfaE1GhI=";
|
||||
};
|
||||
|
||||
# GitHub archives leave the ggml submodule as an empty directory.
|
||||
@@ -537,6 +537,7 @@
|
||||
runHook preInstall
|
||||
mkdir -p "$out"
|
||||
cp -v build/omnivoice-tts "$out/omnivoice-tts-linux-x86_64"
|
||||
cp -v build/tts-server "$out/tts-server-linux-x86_64"
|
||||
find build -name 'libggml*.so*' -type f -exec cp -v {} "$out/" \;
|
||||
find build -name 'libggml*.so*' -type l -exec cp -vL {} "$out/" \;
|
||||
for file in "$out"/*; do
|
||||
@@ -1118,6 +1119,7 @@
|
||||
brand/trayTemplate.png \
|
||||
brand/trayRecordingTemplate.png \
|
||||
bin/omnivoice-tts-linux-x86_64 \
|
||||
bin/tts-server-linux-x86_64 \
|
||||
bin/checksums.sha256 \
|
||||
tools/uv \
|
||||
native/voicestudio-desktop-bridge \
|
||||
|
||||
@@ -8,8 +8,8 @@ VoiceStudio source: https://github.com/debpalash/VoiceStudio
|
||||
Runtime pins: mobile/native/pins.json
|
||||
|
||||
sherpa-onnx: https://github.com/k2-fsa/sherpa-onnx/tree/11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf
|
||||
omnivoice.cpp: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8
|
||||
omnivoice-ggml: https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd
|
||||
omnivoice.cpp: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78
|
||||
omnivoice-ggml: https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d
|
||||
llama.cpp: https://github.com/ggml-org/llama.cpp/tree/797de63b2fa7396dcc8caca76834c699ac84e1c3
|
||||
llama-ggml: https://github.com/ggml-org/llama.cpp/tree/797de63b2fa7396dcc8caca76834c699ac84e1c3/ggml
|
||||
espeak-ng-for-piper: https://github.com/csukuangfj/espeak-ng/archive/ed530aa113046142eb5115cf2fc9157854d0ffe1.zip
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
omnivoice-ggml
|
||||
Source: https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd
|
||||
Source: https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d
|
||||
|
||||
LICENSE
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
omnivoice.cpp
|
||||
Source: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8
|
||||
Source: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78
|
||||
|
||||
LICENSE
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
},
|
||||
{
|
||||
"name": "omnivoice.cpp",
|
||||
"source": "https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8",
|
||||
"source_sha256": "db7898b061692c2c8a83a43bf9af64ac4419b14a8bc44584aae497fc40cbced5",
|
||||
"notice_sha256": "39170a56e1de354d1e60cba242855bee8b81812ec1520bc0823ffeda4df9d440"
|
||||
"source": "https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78",
|
||||
"source_sha256": "8384a94c1530a4b2befc07c253ea9af084cbbfd06b6ecb9aa728894c82fcd038",
|
||||
"notice_sha256": "4af4d6301b1338e3d307b19ac5f0d08b791757ea6a53996b983ed44eca19cf1c"
|
||||
},
|
||||
{
|
||||
"name": "omnivoice-ggml",
|
||||
"source": "https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd",
|
||||
"source": "https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d",
|
||||
"source_sha256": "git-tree-verified",
|
||||
"notice_sha256": "0fa38f8cd0f5acd4a05a6dbe137286983bf57e02ef71cff47fba9e5b3a44362f"
|
||||
"notice_sha256": "5279f26af19153d573c8c05345064ab6dbe1abbf067df61357497a8a5754ed2c"
|
||||
},
|
||||
{
|
||||
"name": "llama.cpp",
|
||||
|
||||
@@ -201,7 +201,7 @@ All tabs work without pairing once on-device models are installed (see M2); the
|
||||
| Capability | Runtime | Pin |
|
||||
|---|---|---|
|
||||
| TTS (preset voices), dictation, transcription | sherpa-onnx | release `v1.13.8` |
|
||||
| Voice cloning | omnivoice.cpp (GGML) | commit `886fc079838ca7400cb2b42b36e2a65aa1daabe8` (same as desktop `quant_map.json`) |
|
||||
| Voice cloning | omnivoice.cpp (GGML) | commit `040c8b344d8c670ce1475194751d119b5ef82c78` (same as desktop `quant_map.json`) |
|
||||
| Dub translation | llama.cpp | release `b11716` |
|
||||
|
||||
- Native libraries are built or fetched by `mobile/native/` scripts at the pins
|
||||
|
||||
@@ -8,8 +8,8 @@ VoiceStudio source: https://github.com/debpalash/VoiceStudio
|
||||
Runtime pins: mobile/native/pins.json
|
||||
|
||||
sherpa-onnx: https://github.com/k2-fsa/sherpa-onnx/tree/11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf
|
||||
omnivoice.cpp: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8
|
||||
omnivoice-ggml: https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd
|
||||
omnivoice.cpp: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78
|
||||
omnivoice-ggml: https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d
|
||||
llama.cpp: https://github.com/ggml-org/llama.cpp/tree/797de63b2fa7396dcc8caca76834c699ac84e1c3
|
||||
llama-ggml: https://github.com/ggml-org/llama.cpp/tree/797de63b2fa7396dcc8caca76834c699ac84e1c3/ggml
|
||||
espeak-ng-for-piper: https://github.com/csukuangfj/espeak-ng/archive/ed530aa113046142eb5115cf2fc9157854d0ffe1.zip
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
omnivoice-ggml
|
||||
Source: https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd
|
||||
Source: https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d
|
||||
|
||||
LICENSE
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
omnivoice.cpp
|
||||
Source: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8
|
||||
Source: https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78
|
||||
|
||||
LICENSE
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
},
|
||||
{
|
||||
"name": "omnivoice.cpp",
|
||||
"source": "https://github.com/ServeurpersoCom/omnivoice.cpp/tree/886fc079838ca7400cb2b42b36e2a65aa1daabe8",
|
||||
"source_sha256": "db7898b061692c2c8a83a43bf9af64ac4419b14a8bc44584aae497fc40cbced5",
|
||||
"notice_sha256": "39170a56e1de354d1e60cba242855bee8b81812ec1520bc0823ffeda4df9d440"
|
||||
"source": "https://github.com/ServeurpersoCom/omnivoice.cpp/tree/040c8b344d8c670ce1475194751d119b5ef82c78",
|
||||
"source_sha256": "8384a94c1530a4b2befc07c253ea9af084cbbfd06b6ecb9aa728894c82fcd038",
|
||||
"notice_sha256": "4af4d6301b1338e3d307b19ac5f0d08b791757ea6a53996b983ed44eca19cf1c"
|
||||
},
|
||||
{
|
||||
"name": "omnivoice-ggml",
|
||||
"source": "https://github.com/ServeurpersoCom/ggml/tree/f3bc6505c4e2ede83a193e0fb4695938ff3804fd",
|
||||
"source": "https://github.com/ServeurpersoCom/ggml/tree/d5152bf4348453068aa8de0d479caef40a613b9d",
|
||||
"source_sha256": "git-tree-verified",
|
||||
"notice_sha256": "0fa38f8cd0f5acd4a05a6dbe137286983bf57e02ef71cff47fba9e5b3a44362f"
|
||||
"notice_sha256": "5279f26af19153d573c8c05345064ab6dbe1abbf067df61357497a8a5754ed2c"
|
||||
},
|
||||
{
|
||||
"name": "llama.cpp",
|
||||
|
||||
@@ -21,7 +21,7 @@ Everything fetched or generated lives in the repository-ignored `build/`.
|
||||
The AAR's SHA-256 comes from `pins.json`. Source archives use the pinned commit
|
||||
in that file and a reviewed SHA-256 in `source-checksums.json`; a changed pin
|
||||
without a matching checksum fails closed. The additional GGML pin is the
|
||||
OmniVoice commit's `ggml` gitlink, `f3bc6505c4e2ede83a193e0fb4695938ff3804fd`.
|
||||
OmniVoice commit's `ggml` gitlink, `d5152bf4348453068aa8de0d479caef40a613b9d`.
|
||||
No git command changes the app checkout or populates a nested git repository.
|
||||
Standalone builds and Gradle fetch-task executions recheck archive hashes. Extracted sources and per-ABI CMake
|
||||
outputs are reused; deleting `build/` produces a complete source rebuild.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"omnivoice.cpp": {"commit":"886fc079838ca7400cb2b42b36e2a65aa1daabe8","sha256":"db7898b061692c2c8a83a43bf9af64ac4419b14a8bc44584aae497fc40cbced5"},
|
||||
"omnivoice.cpp": {"commit":"040c8b344d8c670ce1475194751d119b5ef82c78","sha256":"8384a94c1530a4b2befc07c253ea9af084cbbfd06b6ecb9aa728894c82fcd038"},
|
||||
"llama.cpp": {"commit":"797de63b2fa7396dcc8caca76834c699ac84e1c3","sha256":"9bd5be5bc2ab0e0f5146bc6fbdd3a4a834383aaffa105faeeada119e83d51f3e"},
|
||||
"ggml": {"repo":"ServeurpersoCom/ggml","commit":"f3bc6505c4e2ede83a193e0fb4695938ff3804fd","sha256":"662bc4da4088eb5da2f26095ce9bd2bf5b74053843be369897ecc64d66b6c9df"}
|
||||
"ggml": {"repo":"ServeurpersoCom/ggml","commit":"d5152bf4348453068aa8de0d479caef40a613b9d","sha256":"227b00e62a113dff4e1c22ed00208f7e0df41b7b404a82dfc5ef8876a3fef408"}
|
||||
}
|
||||
@@ -1,20 +1,15 @@
|
||||
--- a/src/backend.h
|
||||
+++ b/src/backend.h
|
||||
@@ -67,8 +67,12 @@
|
||||
// Subsequent calls reuse the same backend (single VMM pool). Returns a
|
||||
// BackendPair with .backend == NULL when initialisation fails; the caller
|
||||
// must check this before passing it to any pipeline_*_load.
|
||||
@@ -90,7 +90,7 @@ static void ov_ggml_log(enum ggml_log_level level, const char * text, void * use
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
-static BackendPair backend_init(const char * label) {
|
||||
+static BackendPair backend_init(const char * label, const char * requested_backend = nullptr) {
|
||||
if (g_backend_refs > 0) {
|
||||
+ // A scoped CPU request must never reuse an already loaded GPU backend.
|
||||
+ if (requested_backend && std::strcmp(requested_backend, ggml_backend_name(g_backend_cache.backend)) != 0) {
|
||||
+ return BackendPair{};
|
||||
+ }
|
||||
g_backend_refs++;
|
||||
ov_log(OV_LOG_INFO, "[Load] %s backend: %s (shared)", label, ggml_backend_name(g_backend_cache.backend));
|
||||
return g_backend_cache;
|
||||
@@ -79,7 +83,7 @@
|
||||
// Magic static: log callback install and dynamic backend loading
|
||||
// happen exactly once, safe under concurrent init calls.
|
||||
static const bool loaded = [] {
|
||||
@@ -104,7 +104,7 @@ static BackendPair backend_init(const char * label) {
|
||||
|
||||
// GGML_BACKEND env var: force a specific device instead of auto-best.
|
||||
// Device names: CUDA0, Vulkan0, CPU, BLAS (see ggml_backend_dev_name).
|
||||
@@ -23,24 +18,10 @@
|
||||
if (force_backend) {
|
||||
bp.backend = ggml_backend_init_by_name(force_backend, nullptr);
|
||||
if (!bp.backend) {
|
||||
--- a/src/omnivoice.h
|
||||
+++ b/src/omnivoice.h
|
||||
@@ -123,6 +123,11 @@
|
||||
// owns its GGML backend pair and must be released with ov_free.
|
||||
OV_API struct ov_context * ov_init(const struct ov_init_params * params);
|
||||
|
||||
+// VoiceStudio: task-scoped backend choice, without changing process environment.
|
||||
+// NULL preserves ov_init defaults; "CPU" explicitly disables GPU allocation.
|
||||
+// Existing contexts using a different backend must be released first.
|
||||
+OV_API struct ov_context * ov_init_with_backend(const struct ov_init_params * params, const char * backend);
|
||||
+
|
||||
// Release every module owned by the handle and free the handle itself.
|
||||
// Safe on NULL.
|
||||
OV_API void ov_free(struct ov_context * ov);
|
||||
--- a/src/omnivoice.cpp
|
||||
+++ b/src/omnivoice.cpp
|
||||
@@ -205,7 +205,7 @@
|
||||
p->on_chunk_user_data = nullptr;
|
||||
@@ -209,7 +209,7 @@ void ov_tts_default_params(struct ov_tts_params * p) {
|
||||
p->postproc = true;
|
||||
}
|
||||
|
||||
-struct ov_context * ov_init(const struct ov_init_params * params) {
|
||||
@@ -48,7 +29,7 @@
|
||||
if (!params || !params->model_path) {
|
||||
ov_set_error("ov_init: params or model_path is NULL");
|
||||
ov_log(OV_LOG_ERROR, "[OmniVoice] ov_init requires a model_path");
|
||||
@@ -234,7 +234,7 @@
|
||||
@@ -238,7 +238,7 @@ struct ov_context * ov_init(const struct ov_init_params * params) {
|
||||
// ov_free, which is idempotent on partial state (NULL-safe sched, NULL
|
||||
// GGUF handles, refcount-correct backend release).
|
||||
try {
|
||||
@@ -57,18 +38,31 @@
|
||||
if (!ov->bp.backend) {
|
||||
ov_throw("ov_init: backend_init failed (no GGML backend available)");
|
||||
}
|
||||
@@ -265,6 +265,14 @@
|
||||
}
|
||||
|
||||
@@ -271,6 +271,14 @@ struct ov_context * ov_init(const struct ov_init_params * params) {
|
||||
return ov;
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
+struct ov_context * ov_init(const struct ov_init_params * params) {
|
||||
+ return ov_init_internal(params, nullptr);
|
||||
+}
|
||||
+
|
||||
+struct ov_context * ov_init_with_backend(const struct ov_init_params * params, const char * backend) {
|
||||
+ return ov_init_internal(params, backend);
|
||||
}
|
||||
|
||||
+}
|
||||
+
|
||||
void ov_free(struct ov_context * ov) {
|
||||
if (!ov) {
|
||||
return;
|
||||
--- a/src/omnivoice.h
|
||||
+++ b/src/omnivoice.h
|
||||
@@ -123,6 +123,10 @@ OV_API void ov_init_default_params(struct ov_init_params * p);
|
||||
// owns its GGML backend pair and must be released with ov_free.
|
||||
OV_API struct ov_context * ov_init(const struct ov_init_params * params);
|
||||
|
||||
+// VoiceStudio: task-scoped backend choice, without changing process environment.
|
||||
+// NULL preserves ov_init defaults; "CPU" explicitly disables GPU allocation.
|
||||
+OV_API struct ov_context * ov_init_with_backend(const struct ov_init_params * params, const char * backend);
|
||||
+
|
||||
// Release every module owned by the handle and free the handle itself.
|
||||
// Safe on NULL.
|
||||
OV_API void ov_free(struct ov_context * ov);
|
||||
@@ -10,7 +10,7 @@
|
||||
"ios": "built from source at the commit above with its build-ios.sh (needs Xcode; CI macOS runner)"
|
||||
},
|
||||
"omnivoice.cpp": {
|
||||
"source": {"repo": "https://github.com/ServeurpersoCom/omnivoice.cpp", "commit": "886fc079838ca7400cb2b42b36e2a65aa1daabe8", "submodules": true},
|
||||
"source": {"repo": "https://github.com/ServeurpersoCom/omnivoice.cpp", "commit": "040c8b344d8c670ce1475194751d119b5ef82c78", "submodules": true},
|
||||
"licence": "MIT",
|
||||
"note": "Same commit as the desktop engine (backend/engines/omnivoice_gguf/quant_map.json runtime_commit_sha). Built from source: iOS via CMake + Xcode toolchain (Metal), Android via NDK CMake (arm64-v8a, x86_64)."
|
||||
},
|
||||
|
||||
@@ -139,14 +139,14 @@ copy_msvc_runtime() {
|
||||
# Multi-config generators (Visual Studio) put the executable under
|
||||
# build/Release/; single-config ones (Ninja, Makefiles) put it in build/.
|
||||
built_windows_exe() {
|
||||
local candidate
|
||||
for candidate in build/Release/omnivoice-tts.exe build/omnivoice-tts.exe; do
|
||||
local candidate tool="${1:-omnivoice-tts}"
|
||||
for candidate in "build/Release/$tool.exe" "build/$tool.exe"; do
|
||||
if [[ -f "$candidate" ]]; then
|
||||
printf '%s\n' "$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo "omnivoice-tts.exe not found in build/Release/ or build/" >&2
|
||||
echo "$tool.exe not found in build/Release/ or build/" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -170,10 +170,24 @@ case "$PLATFORM" in
|
||||
esac
|
||||
|
||||
OUT_NAME="omnivoice-tts-$PLATFORM"
|
||||
# The resident server (#3654) ships beside the CLI: the backend looks for
|
||||
# tts-server-<platform> next to omnivoice-tts-<platform>. It is built by the
|
||||
# same cmake invocation (an always-built target since 040c8b3), so a missing
|
||||
# binary means the pin predates it and must fail the build, not ship a runtime
|
||||
# whose resident mode silently never engages.
|
||||
SERVER_NAME="tts-server-$PLATFORM"
|
||||
case "$PLATFORM" in
|
||||
windows-x86_64) OUT_NAME="$OUT_NAME.exe" ;;
|
||||
windows-x86_64) OUT_NAME="$OUT_NAME.exe"; SERVER_NAME="$SERVER_NAME.exe" ;;
|
||||
esac
|
||||
|
||||
copy_server() {
|
||||
if [[ ! -f build/tts-server ]]; then
|
||||
echo "tts-server not found in build/ (omnivoice.cpp pin predates it)" >&2
|
||||
return 1
|
||||
fi
|
||||
cp -v build/tts-server "$BIN_DIR/$SERVER_NAME"
|
||||
}
|
||||
|
||||
case "$PLATFORM" in
|
||||
linux-x86_64|linux-aarch64)
|
||||
if ! try_vulkan_build; then
|
||||
@@ -187,6 +201,7 @@ case "$PLATFORM" in
|
||||
fi
|
||||
fi
|
||||
cp -v build/omnivoice-tts "$BIN_DIR/$OUT_NAME"
|
||||
copy_server
|
||||
copy_shared_libs
|
||||
;;
|
||||
windows-x86_64)
|
||||
@@ -196,6 +211,7 @@ case "$PLATFORM" in
|
||||
fi
|
||||
exe="$(built_windows_exe)"
|
||||
cp -v "$exe" "$BIN_DIR/$OUT_NAME"
|
||||
cp -v "$(built_windows_exe tts-server)" "$BIN_DIR/$SERVER_NAME"
|
||||
copy_shared_libs
|
||||
copy_msvc_runtime
|
||||
;;
|
||||
@@ -203,6 +219,7 @@ case "$PLATFORM" in
|
||||
# x86_64 Macs build the CPU variant; Metal on Intel is undocumented.
|
||||
portable_x86_cpu_build -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||
cp -v build/omnivoice-tts "$BIN_DIR/$OUT_NAME"
|
||||
copy_server
|
||||
copy_shared_libs
|
||||
;;
|
||||
darwin-arm64)
|
||||
@@ -211,6 +228,7 @@ case "$PLATFORM" in
|
||||
if cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_METAL=ON -DCMAKE_OSX_ARCHITECTURES=arm64; then
|
||||
if cmake --build build --config Release -j "$BUILD_JOBS"; then
|
||||
cp -v build/omnivoice-tts "$BIN_DIR/$OUT_NAME"
|
||||
copy_server
|
||||
copy_shared_libs
|
||||
else
|
||||
echo "→ Metal build failed during compilation; macOS Apple Silicon falls back to in-process VoiceStudioBackend per Pitfall 1." >&2
|
||||
@@ -244,7 +262,7 @@ DIGEST="$(sha256_of "$OUT_NAME")"
|
||||
MANIFEST="$BIN_DIR/checksums.sha256"
|
||||
TMP_MANIFEST="$(mktemp)"
|
||||
OWNED="$(mktemp)"
|
||||
{ printf '%s\n' "$OUT_NAME"; sort -u "$COPIED_LIBS"; } > "$OWNED"
|
||||
{ printf '%s\n' "$OUT_NAME" "$SERVER_NAME"; sort -u "$COPIED_LIBS"; } > "$OWNED"
|
||||
if [[ -f "$MANIFEST" ]]; then
|
||||
awk 'NR == FNR { owned[$0] = 1; next } !($2 in owned)' "$OWNED" "$MANIFEST" > "$TMP_MANIFEST"
|
||||
fi
|
||||
|
||||
@@ -130,6 +130,17 @@ def test_without_a_server_binary_every_request_spawns_the_cli(rig):
|
||||
assert rig.resident.server_status() == (False, "no tts-server binary is bundled")
|
||||
|
||||
|
||||
def test_a_missing_server_logs_why_resident_mode_fell_back(rig, caplog):
|
||||
rig.server_bin.unlink()
|
||||
rig.resident._STATUS_CACHE.clear()
|
||||
rig.resident._UNAVAILABLE_LOGGED.clear()
|
||||
with caplog.at_level("INFO", logger="omnivoice.gguf"):
|
||||
rig.instance.generate("one")
|
||||
rig.instance.generate("two")
|
||||
lines = [r.getMessage() for r in caplog.records if "unavailable" in r.getMessage()]
|
||||
assert len(lines) == 1 and "no tts-server binary is bundled" in lines[0]
|
||||
|
||||
|
||||
def test_an_installer_manifest_must_list_the_server(rig, monkeypatch):
|
||||
monkeypatch.setattr(rig.mod, "_load_checksum_manifest", lambda: {rig.cli.name: "0" * 64})
|
||||
rig.resident._STATUS_CACHE.clear()
|
||||
|
||||
@@ -9,6 +9,7 @@ the packaged layout matches the backend's lookup.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -100,6 +101,7 @@ def _run_windows_build(tmp_path: Path, runtime: dict[str, str]):
|
||||
"git": 'if [[ "$1" == clone ]]; then for d in "$@"; do :; done; mkdir -p "$d"; fi',
|
||||
"cmake": 'if [[ "$1" == --build ]]; then mkdir -p build/Release;'
|
||||
' printf rt > build/Release/omnivoice-tts.exe;'
|
||||
' printf srv > build/Release/tts-server.exe;'
|
||||
' printf lib > build/Release/ggml-cpu-haswell.dll; fi',
|
||||
}
|
||||
msvc = tmp_path / "msvc"
|
||||
@@ -140,3 +142,38 @@ def test_every_parallel_build_is_bounded():
|
||||
assert '-j "$BUILD_JOBS"' in line, f"{rel}: {line.strip()}"
|
||||
script = (REPO / "scripts/build-omnivoice-tts.sh").read_text(encoding="utf-8")
|
||||
assert script.index("BUILD_JOBS=") < script.index('source "$REPO_ROOT/scripts/lib/omnivoice-vulkan.sh"')
|
||||
|
||||
|
||||
# ── resident tts-server ships beside the CLI (#3654) ───────────────────────
|
||||
|
||||
def test_windows_build_ships_and_checksums_the_resident_server(tmp_path):
|
||||
result = _run_windows_build(tmp_path, {"msvcp140.dll": "m", "vcruntime140.dll": "v"})
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
assert (tmp_path / "bin" / "tts-server-windows-x86_64.exe").read_text() == "srv"
|
||||
manifest = (tmp_path / "bin" / "checksums.sha256").read_text(encoding="utf-8")
|
||||
assert " tts-server-windows-x86_64.exe\n" in manifest
|
||||
|
||||
|
||||
def test_build_fails_when_the_pin_has_no_resident_server(tmp_path):
|
||||
# A pin older than omnivoice.cpp 040c8b3 builds no tts-server; shipping that
|
||||
# would leave resident mode silently inactive in every installer.
|
||||
tools = {
|
||||
"git": 'if [[ "$1" == clone ]]; then for d in "$@"; do :; done; mkdir -p "$d"; fi',
|
||||
"cmake": 'if [[ "$1" == --build ]]; then mkdir -p build/Release;'
|
||||
' printf rt > build/Release/omnivoice-tts.exe; fi',
|
||||
}
|
||||
result = run_build(tmp_path, "windows-x86_64", tools=tools)
|
||||
assert result.returncode != 0
|
||||
assert "tts-server.exe not found" in result.stderr
|
||||
|
||||
|
||||
def test_build_workflow_uploads_and_checks_the_resident_server():
|
||||
wf = _workflow("build-omnivoice-tts.yml")
|
||||
job = wf["jobs"]["build-omnivoice-tts"]
|
||||
upload = next(s for s in job["steps"] if s.get("name") == "Upload binary artifact")
|
||||
assert "bin/tts-server-${{ matrix.platform }}*" in upload["with"]["path"]
|
||||
check = next(s for s in job["steps"] if s.get("name") == "Check the resident server was built and checksummed")
|
||||
assert "tts-server-$PLATFORM" in check["run"] and "checksums.sha256" in check["run"]
|
||||
# The resident server needs a pin that builds it (voice registry, 040c8b3).
|
||||
pin = json.loads((REPO / "backend/engines/omnivoice_gguf/quant_map.json").read_text(encoding="utf-8"))
|
||||
assert pin["_meta"]["runtime_commit_sha"] == "040c8b344d8c670ce1475194751d119b5ef82c78"
|
||||
@@ -30,6 +30,7 @@ def test_x86_cpu_build_is_portable(tmp_path, platform):
|
||||
"cmake": 'printf "%s\\n" "$*" >> "$CMAKE_LOG"\n'
|
||||
'if [[ "$1" == --build ]]; then mkdir -p build/Release;'
|
||||
' printf rt > build/omnivoice-tts; printf rt > build/Release/omnivoice-tts.exe;'
|
||||
' printf rt > build/tts-server; printf rt > build/Release/tts-server.exe;'
|
||||
' printf lib > build/libggml-cpu-haswell.so; fi',
|
||||
}
|
||||
log = tmp_path / "cmake.log"
|
||||
|
||||
@@ -191,6 +191,8 @@ if [[ "${1:-}" == "--build" ]]; then
|
||||
mkdir -p build
|
||||
printf '\177ELFfake' > build/omnivoice-tts
|
||||
chmod +x build/omnivoice-tts
|
||||
printf '\177ELFserver' > build/tts-server
|
||||
chmod +x build/tts-server
|
||||
else
|
||||
mkdir -p build
|
||||
if [[ "$FAKE_FAIL_CONFIGURE" == "1" && "$*" == *"-DGGML_VULKAN=ON"* ]]; then
|
||||
@@ -350,9 +352,11 @@ def test_windows_build_finds_the_exe_for_either_generator():
|
||||
# failed every Ninja build at the copy step (#3042).
|
||||
script = (REPO / "scripts" / "build-omnivoice-tts.sh").read_text(encoding="utf-8")
|
||||
finder = script.split("built_windows_exe() {", 1)[1].split("\n}", 1)[0]
|
||||
assert "build/Release/omnivoice-tts.exe" in finder
|
||||
assert "build/omnivoice-tts.exe" in finder
|
||||
assert 'tool="${1:-omnivoice-tts}"' in finder
|
||||
assert '"build/Release/$tool.exe"' in finder
|
||||
assert '"build/$tool.exe"' in finder
|
||||
assert 'exe="$(built_windows_exe)"' in script
|
||||
assert "built_windows_exe tts-server" in script
|
||||
|
||||
|
||||
def test_manifest_covers_every_copied_library():
|
||||
|
||||
@@ -28,6 +28,8 @@ if [[ "${1:-}" == --build ]]; then
|
||||
mkdir -p build/Release
|
||||
printf runtime > build/omnivoice-tts
|
||||
printf runtime > build/Release/omnivoice-tts.exe
|
||||
printf server > build/tts-server
|
||||
printf server > build/Release/tts-server.exe
|
||||
printf library > build/libggml-vulkan.so
|
||||
printf library > build/Release/ggml-vulkan.dll
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user