diff --git a/docs/CURRENT_SYSTEM.md b/docs/CURRENT_SYSTEM.md index 0aaf4b6..e7aea8f 100644 --- a/docs/CURRENT_SYSTEM.md +++ b/docs/CURRENT_SYSTEM.md @@ -24,9 +24,13 @@ neuen Mehrbenutzer-Schalter; sie bleiben produktiv aus. SSD-Druck beim langen Einlesen besteht fort. Das vorherige IQ3-Single-Profil wurde regulär wieder geladen. Das MP3-Update wurde anschließend auf diese Strata-Version aufgesetzt und mit expliziter Neustartfreigabe aktiviert. [Sprachtests und WebUI-Anbindung](experiments/hermes-voice-2026-10-17/README.md). -Browser-Diktat und lokale Athena-TTS-Wiedergabe sind bestätigt. Die ausdrücklich -freigegebene, auf eine LAN-URL begrenzte WebUI-Anpassung ist persistent aktiv. -Offen: OmniVoice braucht eine feste Referenz, damit die Stimme nicht pro Abschnitt wechselt. +Browser-Diktat und lokale Athena-TTS-Wiedergabe sind bestätigt. Die gezielte +LAN-Ausnahme ist persistent aktiv; Anna ist als feste Referenz hinterlegt. +Der [CPU-TTS-Vergleich mit geladenem Strata 512K](experiments/tts-cpu-with-strata-2026-10-17/README.md) +zeigt: OmniVoice auf Athena etwa20-mal langsamer als Echtzeit; Qwen1.7B und +VoxCPM2 überschreiten das 8-GiB-Testbudget. Piper auf AT-Helper schafft dagegen +0,4–0,7s für etwa3,3s Audio. Hermes ist noch nicht auf diesen Piper-Dienst +umgestellt; seine OmniVoice-Anbindung ist weiterhin GPU-TTS. Am 11. Oktober 2026: Strata-Q4 nach Vergleich verworfen, keine produktive Q4-Profilfreigabe. Isolierte Q4-Testdateien und Gewichte entfernt; historische diff --git a/docs/experiments/tts-cpu-with-strata-2026-10-17/README.md b/docs/experiments/tts-cpu-with-strata-2026-10-17/README.md new file mode 100644 index 0000000..6d9598f --- /dev/null +++ b/docs/experiments/tts-cpu-with-strata-2026-10-17/README.md @@ -0,0 +1,109 @@ +# CPU TTS while Strata IQ3 512K remains active — 17 October 2026 + +The earlier standalone OmniVoice GPU speed was NOT evidence for TTS alongside +Strata. This comparison keeps the regular `flash-next-strata-iq3-512k` profile +loaded and makes sustained synthetic 512-token generation requests while each +Athena CPU TTS model is tested sequentially. The regular API evicts the previous +GPU OmniVoice worker when loading Strata. No production profile or RAM policy +is modified and Deck is not restarted. + +Athena: Ryzen 5 5600, 6 physical cores / 12 threads, 48-GB-class system RAM, +RTX 3060 12 GiB + RTX 5080 16 GiB. Normal Strata reserves remain unchanged. +GPU utilization is measured, not claimed to be a synthetic constant 100%. +Both GPUs retain their normal model allocation. Each CPU container has no NVIDIA +runtime/device exposure (`runc`, CUDA unavailable assertion), at most 6 CPU +threads/6 CPU quota, at most 8 GiB memory, no container swap, and at least about +3 GiB available host RAM reserved when admitting the test. This is a practical +coexistence budget, not a universal model memory requirement. + +Identical synthetic sentence: +"Hallo Michael, die Sprachausgabe läuft jetzt auf der CPU." +OmniVoice and VoxCPM2 use the existing private Anna reference; Qwen1.7 uses its +existing Ryan embedding. All weights/runtimes are already installed and offline. +The existing PyTorch runtimes are used in CPU mode; OmniVoice and Qwen use +float32, OmniVoice 32 diffusion steps, VoxCPM2 10 steps. No quantization changes, +new model downloads or benchmark-only production tuning. + +## Test harness corrections + +Initial OmniVoice/Qwen imports inherited a PyTorch compiler-cache path pointing +to read-only production state. Those attempts are preparation failures, not +performance results. HF, PyTorch/Inductor, Triton and XDG caches were redirected +to the test's writable `/tmp` without changing production runtimes. VoxCPM2's +exit137 was subsequently explicitly confirmed as Docker `OOMKilled=true`. +The initial first-call OmniVoice measurement was followed by an additional +same-process two-call measurement to distinguish startup from sustained speed. + +## Reproduction + +`stage.py` reads only model identifiers/components from the existing profiles +and creates public-weight entry manifests in +`/opt/athena-deck-dev/tts-cpu-strata-20261017`. `benchmark.py` runs CPU synthesis. +`run-comparison.py` orchestrates the offline containers and real API Strata +workload. Its stdin expects a JSON `key` supplied internally from the existing +service identity; never put the credential in Git, CLI arguments or logs. +The script targets the existing image +`athena-deck-standalone:strata-0.1.45-anna-20261017` and current runtime IDs; +on another installation resolve these from each runtime's `active.json` first. + +All model/runtime mounts are read-only; only the test result directory and +bounded temporary cache are writable. Each CPU attempt is bounded to 420s. +Own test containers are removed and the own load loop drains its last request; +Strata remains loaded. Do not run while unrelated user requests are active. + +AT-Helper's already-installed Piper and Qwen0.6 are additional separately +labelled tests on its Xeon X3450; they are not Ryzen measurements. Piper's +production service stays running. A temporary Qwen0.6 test service uses CPU, +no Vulkan/`--ttsgpu`, 4-core quota, 4-GiB memory and no swap; it is stopped after +measurement. No Helper service configuration changes. + +Only scripts, synthetic numeric results and this report belong in Git. Audio, +private Anna reference/transcript and runtime logs do not. These are transient +experiments, not a new persistent service; no new backup/restore dependencies. + +## Results + +| Model / host | Ready after | Synthesis first / repeat | Audio duration | RTF | Result | +|---|---:|---:|---:|---:|---| +| OmniVoice / Athena Ryzen5600 | 7.18s incl imports (5.60s model load) | 82.82 / 82.84s | 4.16 / 4.16s | 19.91 / 19.91 | Too slow on CPU | +| Qwen-TTS1.7B / Athena | 7.93s incl imports | No complete audio | — | — | Confirmed OOM at 8-GiB test budget during first generation | +| VoxCPM2 / Athena | Did not finish loading | No audio | — | — | Confirmed OOM at 8-GiB test budget while loading | +| Piper Thorsten-medium / AT-Helper Xeon X3450 | Already running; reports load2.945s | 0.702 / 0.404s incl local HTTP | 3.320 / 3.367s | 0.211 / 0.120 | Faster than realtime | +| Qwen-TTS0.6B F16 / AT-Helper | Not separately timed | 134.97 / 131.82s | 3.977 / 4.057s | 33.94 / 32.49 | Too slow on CPU | + +RTF = generation time / audio duration; values below1 are faster than realtime. +An earlier valid OmniVoice first-call measurement was92.64s/4.16s (RTF22.27). +The two-call check confirms the slowdown is sustained, not just initialization. +OOM rows have no speed estimate: 8GiB was our safe coexistence budget, not an +assertion that those models can never run on a CPU with more RAM or a different +precision/loading implementation. No BF16/int8/quantized PyTorch variant was +measured. The Qwen0.6 GGUF test already uses the available F16 weights. + +During the final two-call OmniVoice check Strata completed24 synthetic requests +without a recorded error. GPU allocation stayed at11249MiB on3060 and15424MiB +on5080 in all samples. Actual utilization ranged0–52% and4–60%; it is NOT a +100%-utilization stress test, but normal sustained Strata decoding with its +full configured GPU memory allocation. No unrelated GPU stress generator or +extra reservation was used. `summary.json` and full numeric samples document +this distinction. + +OmniVoice output is valid non-silent PCM16 WAV (peak11798); an independent +local STT check recognized the sentence but rendered initial "Hallo" as "Jo". +This is a basic intelligibility check, not a subjective quality score or proof +of exact pronunciation. Private reference audio/transcript remain outside Git. + +Qwen0.6's Vulkan library enumerates/opens the RX470 during startup even without +Vulkan selection flags; the dedicated test logs explicitly confirm CPU for +TTSTransformer, AudioTokenizerDecoder and AudioTokenizerEncoder. GPU-device-FD +presence alone therefore was NOT used as compute-placement evidence. + +All own Athena test containers and synthetic load loops are finished. The own +Helper Qwen CPU service is stopped; Piper's production service is untouched. +Strata IQ3 512K remains loaded, with the same GPU process on both cards. No +Deck/host restart or production profile change occurred during this comparison. + +**Practical conclusion:** use the existing Piper CPU service on AT-Helper for +responsive CPU-only speech. This test does not configure Hermes/Deck to use it +and does not provide a female Piper voice: the installed voice is Thorsten. +The current Hermes OmniVoice setting still requests GPU TTS; it must not be +advertised as the demonstrated concurrent CPU solution. diff --git a/docs/experiments/tts-cpu-with-strata-2026-10-17/athena-results.json b/docs/experiments/tts-cpu-with-strata-2026-10-17/athena-results.json new file mode 100644 index 0000000..4f41e80 --- /dev/null +++ b/docs/experiments/tts-cpu-with-strata-2026-10-17/athena-results.json @@ -0,0 +1,822 @@ +{ + "model": "flash-next-strata-iq3-512k", + "tests": { + "voxcpm": { + "phase": "timeout_or_terminated", + "memory_limit_bytes": 8589934592, + "model": "voxcpm", + "threads": 6, + "text": "Hallo Michael, die Sprachausgabe l\u00e4uft jetzt auf der CPU.", + "runs": [], + "cuda_available": false, + "import_seconds": 1.150627571012592, + "container_exit": 137, + "oom_killed": true + }, + "qwen": { + "phase": "timeout_or_terminated", + "memory_limit_bytes": 8589934592, + "model": "qwen", + "threads": 6, + "text": "Hallo Michael, die Sprachausgabe l\u00e4uft jetzt auf der CPU.", + "runs": [], + "cuda_available": false, + "import_seconds": 1.2652623049798422, + "load_seconds": 6.669334388978314, + "ready_seconds": 7.934829720004927, + "container_wall_seconds": 45.102903991995845, + "container_exit": 137, + "oom_killed": true + }, + "omni": { + "phase": "complete", + "memory_limit_bytes": 8589934592, + "model": "omni", + "threads": 6, + "text": "Hallo Michael, die Sprachausgabe l\u00e4uft jetzt auf der CPU.", + "runs": [ + { + "run": 1, + "generation_seconds": 82.81799395100097, + "audio_seconds": 4.16, + "realtime_factor": 19.90817162283677, + "faster_than_realtime": false, + "sample_rate": 24000 + }, + { + "run": 2, + "generation_seconds": 82.83631674500066, + "audio_seconds": 4.16, + "realtime_factor": 19.91257614062516, + "faster_than_realtime": false, + "sample_rate": 24000 + } + ], + "cuda_available": false, + "import_seconds": 1.5861557539901696, + "load_seconds": 5.595139726996422, + "ready_seconds": 7.181520391983213, + "container_wall_seconds": 174.44673319501453, + "container_exit": 0, + "oom_killed": false + } + }, + "samples": [ + { + "time": 1792266272.8333218, + "gpus": [ + "0, 11249, 12288, 0", + "1, 15424, 16303, 10" + ], + "available_ram_bytes": 12555984896 + }, + { + "time": 1792266275.873488, + "gpus": [ + "0, 11249, 12288, 40", + "1, 15424, 16303, 48" + ], + "available_ram_bytes": 12228669440 + }, + { + "time": 1792266278.9075925, + "gpus": [ + "0, 11249, 12288, 48", + "1, 15424, 16303, 49" + ], + "available_ram_bytes": 12066856960 + }, + { + "time": 1792266281.9520512, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11782148096 + }, + { + "time": 1792266285.0004544, + "gpus": [ + "0, 11249, 12288, 36", + "1, 15424, 16303, 58" + ], + "available_ram_bytes": 11512131584 + }, + { + "time": 1792266288.046898, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11475120128 + }, + { + "time": 1792266291.103199, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11433132032 + }, + { + "time": 1792266294.1433294, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11386130432 + }, + { + "time": 1792266297.1911154, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11584364544 + }, + { + "time": 1792266300.231247, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 55" + ], + "available_ram_bytes": 11562426368 + }, + { + "time": 1792266303.2774734, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11497353216 + }, + { + "time": 1792266306.3269815, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11476025344 + }, + { + "time": 1792266309.378467, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11573059584 + }, + { + "time": 1792266312.4277422, + "gpus": [ + "0, 11249, 12288, 38", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11533393920 + }, + { + "time": 1792266315.4792795, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11564167168 + }, + { + "time": 1792266318.5250578, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11475300352 + }, + { + "time": 1792266321.574479, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 54" + ], + "available_ram_bytes": 11689959424 + }, + { + "time": 1792266324.6310887, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11499442176 + }, + { + "time": 1792266327.671139, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11473059840 + }, + { + "time": 1792266330.731108, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11565867008 + }, + { + "time": 1792266333.7668524, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11493728256 + }, + { + "time": 1792266336.811047, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 56" + ], + "available_ram_bytes": 11500871680 + }, + { + "time": 1792266339.847995, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 45" + ], + "available_ram_bytes": 11447496704 + }, + { + "time": 1792266342.8919418, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11450118144 + }, + { + "time": 1792266345.9277084, + "gpus": [ + "0, 11249, 12288, 31", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11511439360 + }, + { + "time": 1792266348.9773812, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11490476032 + }, + { + "time": 1792266352.0140314, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 48" + ], + "available_ram_bytes": 11518218240 + }, + { + "time": 1792266355.0613005, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11561144320 + }, + { + "time": 1792266358.1019247, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 49" + ], + "available_ram_bytes": 11469123584 + }, + { + "time": 1792266361.155265, + "gpus": [ + "0, 11249, 12288, 32", + "1, 15424, 16303, 55" + ], + "available_ram_bytes": 11485208576 + }, + { + "time": 1792266364.2049446, + "gpus": [ + "0, 11249, 12288, 40", + "1, 15424, 16303, 57" + ], + "available_ram_bytes": 11322552320 + }, + { + "time": 1792266367.2630303, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11475378176 + }, + { + "time": 1792266370.3121123, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11448811520 + }, + { + "time": 1792266373.3534653, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 48" + ], + "available_ram_bytes": 11486351360 + }, + { + "time": 1792266376.4035194, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 49" + ], + "available_ram_bytes": 11634483200 + }, + { + "time": 1792266379.4635725, + "gpus": [ + "0, 11249, 12288, 31", + "1, 15424, 16303, 57" + ], + "available_ram_bytes": 11478138880 + }, + { + "time": 1792266382.507041, + "gpus": [ + "0, 11249, 12288, 49", + "1, 15424, 16303, 37" + ], + "available_ram_bytes": 11471024128 + }, + { + "time": 1792266385.5550444, + "gpus": [ + "0, 11249, 12288, 32", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11435925504 + }, + { + "time": 1792266388.59378, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 57" + ], + "available_ram_bytes": 11439243264 + }, + { + "time": 1792266391.6507733, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 54" + ], + "available_ram_bytes": 11593207808 + }, + { + "time": 1792266394.703132, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 54" + ], + "available_ram_bytes": 11582586880 + }, + { + "time": 1792266397.767227, + "gpus": [ + "0, 11249, 12288, 48", + "1, 15424, 16303, 4" + ], + "available_ram_bytes": 11497504768 + }, + { + "time": 1792266400.8038664, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 58" + ], + "available_ram_bytes": 11459510272 + }, + { + "time": 1792266403.8488815, + "gpus": [ + "0, 11249, 12288, 43", + "1, 15424, 16303, 48" + ], + "available_ram_bytes": 11459850240 + }, + { + "time": 1792266406.8977795, + "gpus": [ + "0, 11249, 12288, 40", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11457875968 + }, + { + "time": 1792266409.9470723, + "gpus": [ + "0, 11249, 12288, 34", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11488374784 + }, + { + "time": 1792266412.993193, + "gpus": [ + "0, 11249, 12288, 38", + "1, 15424, 16303, 55" + ], + "available_ram_bytes": 11482189824 + }, + { + "time": 1792266416.0356221, + "gpus": [ + "0, 11249, 12288, 44", + "1, 15424, 16303, 60" + ], + "available_ram_bytes": 11667210240 + }, + { + "time": 1792266419.0870085, + "gpus": [ + "0, 11249, 12288, 49", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11489882112 + }, + { + "time": 1792266422.1470902, + "gpus": [ + "0, 11249, 12288, 39", + "1, 15424, 16303, 54" + ], + "available_ram_bytes": 11507089408 + }, + { + "time": 1792266425.190181, + "gpus": [ + "0, 11249, 12288, 52", + "1, 15424, 16303, 46" + ], + "available_ram_bytes": 11471912960 + }, + { + "time": 1792266428.2281184, + "gpus": [ + "0, 11249, 12288, 39", + "1, 15424, 16303, 57" + ], + "available_ram_bytes": 11448799232 + }, + { + "time": 1792266431.2694747, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 52" + ], + "available_ram_bytes": 11428847616 + }, + { + "time": 1792266434.319049, + "gpus": [ + "0, 11249, 12288, 41", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11505721344 + }, + { + "time": 1792266437.3550165, + "gpus": [ + "0, 11249, 12288, 45", + "1, 15424, 16303, 53" + ], + "available_ram_bytes": 11468218368 + }, + { + "time": 1792266440.4064262, + "gpus": [ + "0, 11249, 12288, 48", + "1, 15424, 16303, 51" + ], + "available_ram_bytes": 11458244608 + }, + { + "time": 1792266443.4553063, + "gpus": [ + "0, 11249, 12288, 42", + "1, 15424, 16303, 60" + ], + "available_ram_bytes": 11449532416 + }, + { + "time": 1792266446.4909692, + "gpus": [ + "0, 11249, 12288, 46", + "1, 15424, 16303, 50" + ], + "available_ram_bytes": 11583078400 + } + ], + "strata_requests": [ + { + "seconds": 6.628690497018397, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.316447096003685, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.275252280989662, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.0444831929926295, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.574748986022314, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.612668369984021, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.290708145999815, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.379691885987995, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.097678514983272, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.301183952018619, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.552317476016469, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.461933801008854, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.276782717002789, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.2784200420137495, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.365482821012847, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.626683596987277, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.276440226996783, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 6.969592986977659, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.617232279997552, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.079203107015928, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.544935879996046, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.269691217981745, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.358408566011349, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + }, + { + "seconds": 7.418516243022168, + "usage": { + "prompt_tokens": 38, + "completion_tokens": 512, + "total_tokens": 550, + "prompt_tokens_details": { + "cached_tokens": 31 + } + }, + "backend_timings": null + } + ], + "strata_load_request_seconds": 0.18939993099775165, + "finished": true +} \ No newline at end of file diff --git a/docs/experiments/tts-cpu-with-strata-2026-10-17/audio-validation.json b/docs/experiments/tts-cpu-with-strata-2026-10-17/audio-validation.json new file mode 100644 index 0000000..6d92630 --- /dev/null +++ b/docs/experiments/tts-cpu-with-strata-2026-10-17/audio-validation.json @@ -0,0 +1,14 @@ +[ + { + "file": "results/omni/run-1.wav", + "duration": 4.16, + "sample_width": 2, + "peak": 11798 + }, + { + "file": "results/omni/run-2.wav", + "duration": 4.16, + "sample_width": 2, + "peak": 11798 + } +] \ No newline at end of file diff --git a/docs/experiments/tts-cpu-with-strata-2026-10-17/benchmark.py b/docs/experiments/tts-cpu-with-strata-2026-10-17/benchmark.py new file mode 100644 index 0000000..3d8df1d --- /dev/null +++ b/docs/experiments/tts-cpu-with-strata-2026-10-17/benchmark.py @@ -0,0 +1,53 @@ +"""Offline CPU-only TTS comparison; only synthetic text is written to results.""" +import os,json,time,sys,contextlib,traceback +from pathlib import Path +os.environ.update(TORCHINDUCTOR_CACHE_DIR='/tmp/torchinductor',TRITON_CACHE_DIR='/tmp/triton',HF_HOME='/tmp/hf',HF_HUB_CACHE='/tmp/hf/hub',TRANSFORMERS_CACHE='/tmp/hf',TORCH_HOME='/tmp/torch',XDG_CACHE_HOME='/tmp/cache',HF_MODULES_CACHE='/tmp/hf/modules',HUGGINGFACE_HUB_CACHE='/tmp/hf/hub') +root=Path('/test');kind=sys.argv[1];output=root/kind;output.mkdir(exist_ok=True) +started=time.monotonic();result={'model':kind,'phase':'imports','threads':6,'text':'Hallo Michael, die Sprachausgabe läuft jetzt auf der CPU.','runs':[]} +def save(): + p=output/'status.tmp';p.write_text(json.dumps(result,indent=2));p.replace(output/'results.json') +try: + save() + with contextlib.redirect_stdout(sys.stderr): + import torch,soundfile as sf + torch.set_num_threads(6);torch.set_num_interop_threads(1) + assert not torch.cuda.is_available(),'GPU exposed to CPU test' + result['cuda_available']=False;result['import_seconds']=time.monotonic()-started;result['phase']='loading';save();t=time.monotonic() + model_dir=output/'model' + if kind in ('omni','voxcpm'): + entries=json.loads((root/(kind+'-entries.json')).read_text());model_dir.mkdir(exist_ok=True) + for entry in entries: + source=Path('/var/lib/deck/models')/entry['id']/('model'+Path(entry['file']).suffix) + target=model_dir/entry['file'];target.parent.mkdir(parents=True,exist_ok=True) + if not target.exists():target.symlink_to(source) + if kind=='omni': + from omnivoice import OmniVoice,OmniVoiceGenerationConfig + model=OmniVoice.from_pretrained(str(model_dir),device_map='cpu',dtype=torch.float32,local_files_only=True,load_asr=False) + ref=Path('/reference/Anna/reference.wav');ref_text=json.loads(Path('/reference/Anna/reference.json').read_text())['text'] + def generate():return model.generate(text=result['text'],language='German',ref_audio=str(ref),ref_text=ref_text,generation_config=OmniVoiceGenerationConfig(num_step=32,guidance_scale=2.0))[0],model.sampling_rate + elif kind=='voxcpm': + from voxcpm import VoxCPM + model=VoxCPM.from_pretrained(str(model_dir),load_denoiser=False,local_files_only=True,optimize=False,device='cpu') + def generate():return model.generate(text=result['text'],reference_wav_path='/reference/Anna/reference.wav',cfg_value=2.0,inference_timesteps=10,max_len=512,normalize=False,denoise=False,retry_badcase_max_times=1),model.tts_model.sample_rate + elif kind=='qwen': + from qwen_tts import Qwen3TTSModel,VoiceClonePromptItem + from safetensors.torch import load_file + model=Qwen3TTSModel.from_pretrained('/var/lib/deck/tts-runtime/20261006000000000000000000000001/model',device_map='cpu',dtype=torch.float32,attn_implementation='sdpa',local_files_only=True) + rows=load_file('/app/assets/tts-presets/bundle.safetensors',device='cpu');row=rows.get('ryan',rows.get('Ryan')) + voice=VoiceClonePromptItem(ref_code=None,ref_spk_embedding=row.to(device='cpu',dtype=torch.float32).contiguous(),x_vector_only_mode=True,icl_mode=False,ref_text=None) + def generate(): + waves,rate=model.generate_voice_clone(text=result['text'],language='German',voice_clone_prompt=[voice],max_new_tokens=256,do_sample=False) + return waves[0],rate + result['load_seconds']=time.monotonic()-t;result['ready_seconds']=time.monotonic()-started;result['phase']='ready';save() + for i in range(2): + result['phase']='generation-'+str(i+1);save();torch.manual_seed(42);t=time.monotonic() + with torch.inference_mode():wave,rate=generate() + elapsed=time.monotonic()-t + if isinstance(wave,torch.Tensor):wave=wave.detach().float().cpu().numpy() + import numpy as np + wave=np.asarray(wave).squeeze();assert wave.ndim==1 and len(wave)>0 and np.isfinite(wave).all() + duration=len(wave)/rate;sf.write(output/('run-'+str(i+1)+'.wav'),wave,rate,subtype='PCM_16') + result['runs'].append({'run':i+1,'generation_seconds':elapsed,'audio_seconds':duration,'realtime_factor':elapsed/duration,'faster_than_realtime':elapsed