124 lines
7.5 KiB
Markdown
124 lines
7.5 KiB
Markdown
# 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.
|
||
|
||
## Current selection
|
||
|
||
On17 October2026 the regular UI created and published **Pocket Anna**, API-ID
|
||
`pocket-anna`, with its German tokenizer and the existing Anna default voice.
|
||
Hermes now sends model `tts` to its unchanged Athena speech URL. OmniVoice's
|
||
old speech publication is disabled; its profile and weights are retained.
|
||
Actual WAV, MP3 and PCM calls returned200 with unchanged Strata GPU processes.
|
||
Detailed activation, profile/UI, config-preservation and API evidence:
|
||
[Integration acceptance](experiments/pocket-integration-2026-10-17/README.md).
|