Add CPU Pocket TTS profiles and a stable speech endpoint alias

This commit is contained in:
Mikei386 committed 2026-10-17 22:28:36 +02:00
1 parent 0edf132056
commit 96c7f5452b
21 files changed
+611 -25

No files matched your search

+113
View File
@@ -0,0 +1,113 @@
# Pocket TTS in Athena Deck
Pocket is an ordinary Deck **audio/TTS profile** using the original pinned
Kyutai Python engine, exclusively on CPU. The CPU worker has its own queue and
does not acquire GPU reservations, evict Strata or compete for an LLM slot.
The existing API port, bearer token and `/v1/audio/speech` route are retained.
## Client and endpoint selection
Publish exactly one executable TTS profile (audio or a supported voice-TTS
profile) on Deck's endpoint. A client can send `model: "tts"`; Deck resolves
that neutral name to the currently published profile for every new request.
Zero or multiple candidates return409 `tts_default_ambiguous` with instructions,
never an arbitrary model fallback. Concrete profile API names remain supported.
The neutral alias is specific to speech requests, not the chat-model list.
Hermes previously used the correct Athena base URL but explicitly requested
`omnivoice-studio`. Change only that TTS model setting once to `tts`, preserving
base URL, API credential and voice `default`. Subsequent engine selection happens
in Deck; changing the client URL, adding another service or modifying Hermes
code is unnecessary. Do not switch the client until the new profile is published.
Pocket supports this qualified German model revision only; text1–1000 characters,
`language=German/german/de` (German by default), speed1, voices `default` or a saved
named voice. It does not silently substitute an English model, random speaker or
GPU implementation. WAV and MP3 responses and24kHz mono signed16-bit little-endian
PCM streaming use the existing speech routes. `Accept: audio/mpeg` is honored.
The model/voice stays loaded between calls according to the existing audio policy;
`per_request` releases it. Automatic preloading follows the single enabled audio
profile and can warm CPU Pocket while a GPU LLM is busy.
## Persistent state and installation
Everything is under the configured Deck state root, not the experiment directory:
- `pocket-runtime/<installation>/python/`: isolated CPU venv; pinned source commit
and archive SHA256 in `pocket_runtime.py`, exact dependency constraints in
`deploy/pocket-requirements.lock`. `active.json` selects a completed installation.
- `models/<ID>/`: normal catalogue entries for German model and its pinned
tokenizer. The model bundle includes the Mimi audio codec.
- `speech-voices/Anna/pocket-german.safetensors`: private exported Pocket voice,
mode0600. `speech-voices/default.json` already selects Anna. This is separate
from the original Anna WAV/transcript used by other engines.
- `pocket-jobs/`: owned request WAV/PCM outputs and technical job results. Prompts
are sent over stdin to the local worker, not stored in job JSON.
Fresh supported native Debian needs Python with venv, Git (runtime installer
preflight), working HTTPS/CA certificates and FFmpeg for MP3. CPU Torch2.7 is
installed from the official CPU wheel index, with no CUDA or shared production
Python packages. From TTS → Einrichten install Pocket; this installs code only.
Alternatively run `PocketRuntime(<state>/pocket-runtime).start()` as the native
Deck service user from the checked-out application and wait for a complete job.
Do not copy a host venv into a different Python/container filesystem.
Download the pinned German model and tokenizer through Deck's Hugging Face
catalogue using the credential already stored under Settings → Access. Gated
Kyutai model access requires the account's accepted model conditions. Never
print tokens or request another login before checking Deck's configured access.
For already verified downloads, `deploy/import_pocket.py --state <state>
--cache <HF-cache>/hub --anna <authorized-export.safetensors>` copies only the
two public files with hardcoded SHA256 validation and optionally the private
exported Anna state. Run as the Deck service user. It does **not** alter profiles,
endpoint publication or credentials. Source revisions are in that script.
In the normal Deck UI create an audio profile, choose the imported German model,
assign the German tokenizer under components, set speed1, then publish it on the
endpoint and unpublish other TTS profiles. Creating/publishing uses the regular
authenticated management surface. No replacement login/session is generated.
The TTS Test tab switches to the selected engine and offers Anna/default.
To regenerate a private voice after restore, use the same German cloning weights
and official `get_state_for_audio_prompt` / `export_model_state` functions with
the backed-up Anna reference; the earlier reproducible experiment script is
`docs/experiments/small-tts-2026-10-17/anna.py`. A preset-only model cannot clone.
Keep the model/voice loaded for repeated speech. Offline inference reads only
local, assigned catalogue files and the exported voice; it does not receive the
HF credential or download models during requests.
## Backup, restore and updates
The encrypted configuration export includes the normal profiles, model sources,
components, endpoint publication and audio policy, plus a pinned Pocket runtime
rebuild recipe. Restore reinstalls CPU Pocket and restores public model files
through the existing catalogue. Runtime Python environments are rebuilt, not
archived. An incompatible Pocket source revision is reported before restore.
The separate encrypted userdata archive must include **speech-voices** (reference,
default mapping and private exported Pocket voice) and Pocket generated audio.
`deploy/scheduled_backup.py` now includes `speech-voices` and `pocket-jobs`.
The existing userdata restore decrypts to a new empty staging directory; deploy
the recovered `deck/speech-voices` into the configured state root with ownership
of the Deck service user before publishing Pocket. Configuration-only export
contains no private voice/audio. No full fresh-host native restore is claimed.
Updating Pocket requires an explicitly qualified source/model/dependency recipe;
do not unpin production or replace an active venv. Failed installation retains
the previous selected runtime. Deck app updates follow the normal installer.
The user did not request a separate Pocket server/container or changed Hermes
program code, and neither is needed.
## Validation on17 October2026
Real Deck worker running as UID65534 in the existing container with persistent
state, Strata512K loaded: cold call4.62s total for5.20s audio, then1.91s total
for5.36s. Actual synthesis1.71/1.83s, first chunk0.084/0.073s. Both streamed PCM
and WAV files were produced. This is a shorter text than the earlier engine
comparison; do not present these as an improvement on an identical benchmark.
70 focused Linux unit/regression tests covering Pocket routing, neutral alias,
CPU policy, voice path isolation, TTS formats, profile identities/presets and
configuration backup/restore passed. Existing chat tests also fail at unchanged
HEAD with `worker_unavailable`; they are not represented as passing. Final
publication and client/API observations are recorded in the integration evidence.
@@ -0,0 +1,35 @@
# Pocket endpoint integration —17 October2026
The Deck app update and persistent CPU runtime are active. Unchanged existing
profiles/endpoint/audio-policy/reasoning settings were hash-checked across the
idle-only restart; previous Strata IQ3 512K was restored with a minimal regular
API request. No Hermes or OpenCode service restarted. Public catalogue model and
German tokenizer imported from the tested cache with pinned SHA256; private Anna
embedding copied into `speech-voices/Anna`, UID65534, mode0600. No credentials
printed or copied. The previous mistaken host HF401 diagnosis was corrected by
using Deck's existing valid HF credential internally.
The real Deck worker (UID65534) produced two WAVs and PCM chunk files with Anna
while Strata remained loaded; technical results are in `worker-probe.json`.
70 focused Linux tests passed (Pocket, audio policy, MP3, speech reference,
profile identities/presets, encrypted configuration backup/restore). The larger
chat test set has pre-existing `worker_unavailable` failures; an isolated check
against unmodified HEAD `endpoint.py` reproduced the same failure. No claim that
the full suite passed. Local browser JavaScript passed `node --check`; source
passed `py_compile` and `git diff --check`.
The existing scheduled-backup entrypoint `/opt/athena-deck-maintenance/
scheduled_backup.py` and passive state reader were atomically updated from Git
sources. Snapshot schema validation passed with Pocket runtime=true and both
Pocket catalogue sources included. The userdata inventory now includes
`speech-voices` and `pocket-jobs`; no backup key or private media was displayed.
No full fresh-host native restore was performed.
At this checkpoint regular Deck login is pending. No Pocket profile or endpoint
publication is claimed yet. Hermes continues to request `omnivoice-studio` at the
existing Athena address. After GUI profile creation/component assignment and
publication, change only Hermes's TTS model setting to `tts` using its existing
config persistence function; keep URL, credential and voice default. Then test
WAV/MP3/PCM through the real API and check normal browser playback.
Native implementation and repeatable configuration: [Pocket TTS](../../POCKET_TTS.md).
@@ -0,0 +1,7 @@
{
"image": "athena-deck-standalone:5c4eacacf03cade9",
"settings_unchanged": true,
"deck_ready": true,
"previous_model": "flash-next-strata-iq3-512k",
"previous_model_restored": true
}
@@ -0,0 +1,30 @@
{
"run_1": {
"id": "3766b37941e04eae970051b10fb46ac7",
"state": "complete",
"phase": "Pocket-Sprache fertig \u00b7 CPU",
"profile_id": "probe",
"started_at": 1792268562.269745,
"duration": 5.2,
"sample_rate": 24000,
"seconds": 1.7124950040015392,
"first_chunk_seconds": 0.08388529499643482,
"finished_at": 1792268566.8192713,
"total_seconds": 4.615612109977519,
"audio_bytes": 249644
},
"run_2": {
"id": "3995ccd473814913acec32055be6fbd9",
"state": "complete",
"phase": "Pocket-Sprache fertig \u00b7 CPU",
"profile_id": "probe",
"started_at": 1792268566.8853986,
"duration": 5.36,
"sample_rate": 24000,
"seconds": 1.826102835999336,
"first_chunk_seconds": 0.07312235899735242,
"finished_at": 1792268568.7612672,
"total_seconds": 1.908022574003553,
"audio_bytes": 257324
}
}