Integrate trained Kikiri Anna CPU TTS with stable endpoint and restore recipe
This commit is contained in:
1 parent
7e2cd643d6
commit
2ef16dc1ee
25 files changed
+872
-21
No files matched your search
@@ -48,3 +48,6 @@ COPY deploy/import_pocket.py /app/deploy/import_pocket.py
|
||||
COPY deploy/pocket-requirements.lock /app/deploy/pocket-requirements.lock
|
||||
|
||||
COPY seedvc.py seedvc_runtime.py seedvc_worker.py /app/
|
||||
|
||||
COPY kikiri.py kikiri_runtime.py kikiri_worker.py /app/
|
||||
COPY deploy/kikiri /app/deploy/kikiri
|
||||
+2
-2
@@ -15,7 +15,7 @@ import urllib.request
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
LABEL = 'de.casaderoll.athena-deck.standalone'
|
||||
FILES = ['deploy/articulino/register_profile.py','deploy/scheduled_backup.py','deploy/articulino/bootstrap.py','articulino.py','articulino_runtime.py','articulino_worker.py','deploy/articulino/assets.json','deploy/articulino/requirements.lock','deploy/articulino/download.py','deploy/seedvc/bootstrap.py','deploy/seedvc/download.py','deploy/seedvc/requirements.lock','deploy/seedvc/assets.json','deploy/seedvc/versions.json','deploy/seedvc/README.md','seedvc.py','seedvc_runtime.py','seedvc_worker.py','humaneness_pitch.py','humaneness.py','humaneness_runtime.py','deploy/humaneness/bootstrap.py','deploy/humaneness/assets.json','deploy/humaneness/upstream-requirements.txt','deploy/humaneness/requirements.lock','deploy/humaneness/component-assets.json','deploy/humaneness/README.md','stimmatelier_proxy.py','qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
||||
FILES = ['kikiri.py','kikiri_runtime.py','kikiri_worker.py','deploy/kikiri/install.py','deploy/kikiri/bootstrap.py','deploy/kikiri/import_voice.py','deploy/kikiri/requirements.lock','deploy/kikiri/README.md','deploy/articulino/register_profile.py','deploy/scheduled_backup.py','deploy/articulino/bootstrap.py','articulino.py','articulino_runtime.py','articulino_worker.py','deploy/articulino/assets.json','deploy/articulino/requirements.lock','deploy/articulino/download.py','deploy/seedvc/bootstrap.py','deploy/seedvc/download.py','deploy/seedvc/requirements.lock','deploy/seedvc/assets.json','deploy/seedvc/versions.json','deploy/seedvc/README.md','seedvc.py','seedvc_runtime.py','seedvc_worker.py','humaneness_pitch.py','humaneness.py','humaneness_runtime.py','deploy/humaneness/bootstrap.py','deploy/humaneness/assets.json','deploy/humaneness/upstream-requirements.txt','deploy/humaneness/requirements.lock','deploy/humaneness/component-assets.json','deploy/humaneness/README.md','stimmatelier_proxy.py','qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
||||
|
||||
|
||||
FILES += ['soulx_singer.py','soulx_singer_runtime.py','soulx-singer-ui.js','deploy/prepare_soulx_singer.py']
|
||||
@@ -272,7 +272,7 @@ def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=Fals
|
||||
backup_name=config['name']+'-previous'
|
||||
if inspect(backup_name):raise RuntimeError('Rückfall-Containername belegt. Keine Änderung ausgeführt.')
|
||||
stamp=str(time.time_ns())
|
||||
shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('articulino-runtime','articulino-jobs','seedvc-runtime','seedvc-jobs','humaneness-runtime','humaneness-jobs','stimmatelier-ui','qwen-native-runtime','qwen-native-jobs','strata-runtime','strata-worker','strata-data','strata-ssd','strata-install-src','soulx_singer-runtime','soulx_singer-data','seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','xvc-runtime','xvc-data','xvc-prepare','cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','music-remix-runtime','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*'))
|
||||
shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('kikiri-runtime','kikiri-jobs','kikiri-data','articulino-runtime','articulino-jobs','seedvc-runtime','seedvc-jobs','humaneness-runtime','humaneness-jobs','stimmatelier-ui','qwen-native-runtime','qwen-native-jobs','strata-runtime','strata-worker','strata-data','strata-ssd','strata-install-src','soulx_singer-runtime','soulx_singer-data','seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','xvc-runtime','xvc-data','xvc-prepare','cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','music-remix-runtime','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*'))
|
||||
was_running=previous['State']['Running']
|
||||
if was_running:run('docker','stop','--time','15',config['name'])
|
||||
run('docker','rename',config['name'],backup_name)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
ARG DECK_BASE
|
||||
FROM ${DECK_BASE}
|
||||
COPY --chmod=0644 kikiri.py kikiri_runtime.py kikiri_worker.py audio_policy.py backup.py endpoint.py execution_setup.py profiles.py server.py tts-ui.js /app/
|
||||
COPY --chmod=0644 deploy/kikiri/*.py deploy/kikiri/requirements.lock deploy/kikiri/README.md /app/deploy/kikiri/
|
||||
RUN python3 -c "import ast;from pathlib import Path;[ast.parse(Path(p).read_text()) for p in ('/app/kikiri.py','/app/kikiri_runtime.py','/app/kikiri_worker.py','/app/server.py','/app/endpoint.py')]"
|
||||
@@ -0,0 +1,98 @@
|
||||
# Kikiri: private trained Anna, native CPU
|
||||
|
||||
Selected voice: the exact Anna full20 +20 checkpoint/voicepack accepted on
|
||||
27 October 2026, with the narrow confirmed Vögel/Vögeln/Vögelchen phoneme fix.
|
||||
No further training, additional sentence gaps, breath smoothing, pitch shift
|
||||
or reference-voice approximation is part of this adapter. It uses FP32 and
|
||||
four CPU threads, 24-kHz mono PCM16. Granular breath texture and some unusual
|
||||
sentence emphasis remain known listening limitations, not solved claims.
|
||||
|
||||
## Explicit dependencies and preparation
|
||||
|
||||
Native prerequisites: supported Debian x86_64, Python >=3.12 for the operator
|
||||
scripts, Git, CA roots, libstdc++6, libgomp1, FFmpeg (MP3 endpoint output), and
|
||||
the normal Deck service-user/state layout. No running container, global Torch,
|
||||
CUDA library, another model environment or experiment folder is a prerequisite.
|
||||
|
||||
`install.py` independently downloads SHA256-verified CPython3.11.18 and uv0.13.6,
|
||||
then installs CPU-only Torch2.6.0 and the exact qualified package set in
|
||||
`requirements.lock`. Kokoro fork `b96fef95e6a746495f92443fac7c688f90fc57fc` and
|
||||
Misaki fork `6d252a2e02f3b030f22f56686f1a73786c16ffc8` are immutable source pins.
|
||||
The original public config is Kikiri source
|
||||
`a12d0410e89841e6f3c09958ae5c072f90ae1d49`, `training/config.json`, with its
|
||||
fixed checksum in `kikiri_runtime.py`. eSpeak library/data come from the
|
||||
qualified loader wheel; no host speech package is silently assumed.
|
||||
|
||||
As the Deck data owner, import the separately supplied **private** files first:
|
||||
|
||||
```sh
|
||||
python3 deploy/kikiri/import_voice.py --state /var/lib/athena-deck \
|
||||
--model /protected/anna-plus20/model.pth \
|
||||
--voice /protected/anna-plus20/voice.pt \
|
||||
--config /protected/anna-plus20/config.json
|
||||
python3 deploy/kikiri/bootstrap.py --state /var/lib/athena-deck
|
||||
```
|
||||
|
||||
The importer verifies all three fixed hashes before copying; a different voice
|
||||
or corrupt existing destination is rejected. Originals are not changed. The
|
||||
private bundle lives in `STATE/kikiri-data/anna-plus20`, the separately pinned
|
||||
CPU environment in `STATE/kikiri-runtime/ID`. The main weight is imported into
|
||||
the library as `local/kikiri-anna`, content revision equal to its SHA256; it has
|
||||
no fictitious public download location. Private model/voice/config files are
|
||||
not in Git. The original recording is not needed for inference.
|
||||
|
||||
Use an executable private TMPDIR inside the runtime/jobs root: phonemizer
|
||||
copies its shared library there. A noexec `/tmp` is preserved. Readiness is
|
||||
published only after validation; failed setup removes only its own candidate
|
||||
environment and does not destroy an existing active runtime.
|
||||
|
||||
## Profile, endpoint and warm worker
|
||||
|
||||
Create an audio profile in the authenticated existing Deck UI, select the
|
||||
imported Anna model, use `speed=1`, title **Kikiri Anna CPU**, API ID
|
||||
`kikiri-anna-cpu`. Keep it unpublished until its direct test passes. The native
|
||||
operator equivalent may call `Profiles.save` only with Deck stopped at confirmed
|
||||
idle; never rewrite a live profiles.json behind the application.
|
||||
|
||||
The existing TTS page recognizes this model; its own `/api/v1/kikiri` test routes
|
||||
use the same bounded job/audio contract. Shared `/v1/audio/speech` supports
|
||||
explicit `kikiri-anna-cpu` and the neutral `tts` alias, WAV/MP3/PCM, German,
|
||||
`voice=default`/`Anna`, speed1. Publish exactly one dedicated audio profile to
|
||||
switch the neutral alias. Hermes remains configured to `model: tts` on the NAS;
|
||||
no per-bot or Mac/Conduit change is needed. Existing central text preparation
|
||||
remains optional and unchanged. The worker itself only performs the selected
|
||||
German frontend mapping and the narrow Vögel correction.
|
||||
|
||||
The CPU worker uses the configured speech affinity pool, nice10, four Torch
|
||||
threads and one inter-op thread. CPU-only Torch and hidden GPU devices are
|
||||
verified. It requests no GPU lease, does not unload Strata, and refuses startup
|
||||
with less than1.5GiB cgroup headroom. Load and a short frontend/decoder warmup
|
||||
complete before readiness. Warm residency follows the published TTS profile
|
||||
using the existing audio policy; switching publication does not rewrite the
|
||||
saved user preference. Cancellation is cooperative between native chunks,
|
||||
not a claim to interrupt a single model pass. Inputs remain bounded to1000
|
||||
characters and PCM to32MiB; unknown/dropped phonemes fail explicitly.
|
||||
|
||||
## Update, restore and present acceptance limits
|
||||
|
||||
Git publication does not activate this adapter. Install the reviewed Deck files
|
||||
with the normal native service-update method; restart only after explicit Go
|
||||
and confirmed completion of all accepted/queued work. Preserve the current
|
||||
LLM profile/settings and restore it afterwards. In the current read-only Docker
|
||||
deployment a thin image on the exact current base carries only the changed app
|
||||
files; no base-image, driver or Strata rebuild is required. No hot monkeypatch
|
||||
or additional permanent TTS service is used.
|
||||
|
||||
Existing encrypted user-data backup sources now explicitly include
|
||||
`kikiri-data`, `kikiri-jobs` and the local Kikiri library directory. Runtime
|
||||
source/version metadata is included in the configuration recipe. No new backup
|
||||
is run by this change. Restore private media/library first, rebuild the public
|
||||
CPU environment with the pinned recipe, then restore/recheck profile and single
|
||||
TTS publication. A configuration-only backup cannot recreate a private voice
|
||||
and explicitly reports that missing local model. Do not try to download Anna
|
||||
from Hugging Face. A fresh-Debian encrypted end-to-end restore is not tested.
|
||||
|
||||
Rollback selects the previous TTS publication; retain Articulino, Qwen, original
|
||||
Anna and their settings. Any app rollback uses its normal separately approved
|
||||
maintenance path. At preparation time production activation and native-client
|
||||
listening acceptance are still pending; report them separately from tests.
|
||||
@@ -0,0 +1,12 @@
|
||||
"""Install the native CPU recipe after restoring/importing the private voice."""
|
||||
import argparse,json,sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
|
||||
from kikiri_runtime import KikiriRuntime
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('--state',required=True,type=Path);a=p.parse_args()
|
||||
runtime=KikiriRuntime(a.state/'kikiri-runtime')
|
||||
if not runtime.status()['installed']:
|
||||
runtime.start()
|
||||
while runtime.worker.is_alive():runtime.worker.join(1)
|
||||
status=runtime.status();print(json.dumps(status));sys.exit(0 if status['installed'] else 1)
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Import ONLY the selected private +20 model/voice/config, no profile publication."""
|
||||
import argparse,hashlib,json,os,shutil,sys,tempfile
|
||||
from pathlib import Path
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
|
||||
from kikiri_runtime import KikiriRuntime,ASSETS,verify_assets
|
||||
|
||||
def import_voice(state,model,voice,config):
|
||||
state=Path(state);target=state/'kikiri-data/anna-plus20';os.umask(0o077)
|
||||
sources={'model.pth':Path(model),'voice.pt':Path(voice),'config.json':Path(config)}
|
||||
for name,source in sources.items():
|
||||
if source.is_symlink() or not source.is_file():raise ValueError('Normale lokale Datei erforderlich: '+name)
|
||||
with source.open('rb') as f:digest=hashlib.file_digest(f,'sha256').hexdigest()
|
||||
if digest!=ASSETS[name][1]:raise ValueError('Nicht der ausgewählte Anna-Stand: '+name)
|
||||
if target.exists():verify_assets(target)
|
||||
else:
|
||||
target.parent.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||
with tempfile.TemporaryDirectory(dir=target.parent,prefix='.import-') as work:
|
||||
work=Path(work)
|
||||
for name,source in sources.items():shutil.copyfile(source,work/name);(work/name).chmod(0o600)
|
||||
verify_assets(work);work.rename(target)
|
||||
ident=KikiriRuntime(state/'kikiri-runtime').ensure_library()
|
||||
return dict(imported=True,model_id=ident,private_assets='kikiri-data/anna-plus20',profile_published=False)
|
||||
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('--state',required=True,type=Path)
|
||||
for name in ('model','voice','config'):p.add_argument('--'+name,required=True,type=Path)
|
||||
a=p.parse_args();print(json.dumps(import_voice(a.state,a.model,a.voice,a.config)))
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Reproducible native CPU environment; public code only, no private voice download."""
|
||||
import argparse,hashlib,json,os,subprocess,tarfile,urllib.request,zipfile
|
||||
from pathlib import Path
|
||||
PYTHON_URL='https://github.com/astral-sh/python-build-standalone/releases/download/20261026/cpython-3.11.18%2B20261026-x86_64-unknown-linux-gnu-install_only.tar.gz'
|
||||
PYTHON_SHA='a87ee63646c8f8438b7af3954b2135ed2af91d033c631f12a8f20af903046d06'
|
||||
UV_URL='https://files.pythonhosted.org/packages/5c/43/0688ff5142934238f2812e348f4a24e09b57d48bfb38dd8f850325a0d9de/uv-0.13.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl'
|
||||
UV_SHA='22759b8895e1103578de6fb4cd27e94b4399d021023378d29f01333717751fba'
|
||||
|
||||
def download(url,path,expected):
|
||||
with urllib.request.urlopen(url,timeout=120) as source,path.open('wb') as out:
|
||||
while block:=source.read(1024*1024):out.write(block)
|
||||
with path.open('rb') as f:assert hashlib.file_digest(f,'sha256').hexdigest()==expected,'Public download hash mismatch'
|
||||
|
||||
def install(root):
|
||||
root=Path(root).resolve();root.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||
archive=root/'python.tar.gz';download(PYTHON_URL,archive,PYTHON_SHA)
|
||||
with tarfile.open(archive) as t:t.extractall(root,filter='data')
|
||||
archive.unlink()
|
||||
wheel=root/'uv.whl';download(UV_URL,wheel,UV_SHA)
|
||||
with zipfile.ZipFile(wheel) as z:
|
||||
names=[n for n in z.namelist() if n.endswith('/uv')];assert len(names)==1
|
||||
uv=root/'uv';uv.write_bytes(z.read(names[0]));uv.chmod(0o700)
|
||||
wheel.unlink()
|
||||
(root/'tmp').mkdir(mode=0o700,exist_ok=True)
|
||||
# phonemizer copies its shared library into TMPDIR. The production /tmp is
|
||||
# intentionally noexec; use this runtime's own private executable data mount.
|
||||
env=dict(os.environ,TMPDIR=str(root/'tmp'),CUDA_VISIBLE_DEVICES='',UV_NO_CONFIG='1',UV_CACHE_DIR=str(root/'cache'),UV_PYTHON_DOWNLOADS='never',GIT_TERMINAL_PROMPT='0')
|
||||
def run(*args):subprocess.run([str(x) for x in args],env=env,check=True)
|
||||
py=root/'venv/bin/python'
|
||||
run(uv,'venv','--python',root/'python/bin/python3.11',root/'venv')
|
||||
run(uv,'pip','install','--python',py,'--index-url','https://download.pytorch.org/whl/cpu','torch==2.6.0+cpu')
|
||||
run(uv,'pip','install','--python',py,'--extra-index-url','https://download.pytorch.org/whl/cpu',
|
||||
'--index-strategy','unsafe-best-match','-r',Path(__file__).with_name('requirements.lock'))
|
||||
run(uv,'pip','check','--python',py)
|
||||
run(py,'-c','import torch;from kokoro import KModel,KPipeline;from misaki.de import DEG2P;assert torch.version.cuda is None;assert DEG2P()("Die Stimme ist bereit.")[0]')
|
||||
(root/'requirements-resolved.txt').write_text(subprocess.check_output([str(uv),'pip','freeze','--python',str(py)],env=env,text=True))
|
||||
# Wheel/Git build caches are not needed by offline inference.
|
||||
import shutil
|
||||
shutil.rmtree(root/'cache',ignore_errors=True)
|
||||
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('--root',required=True,type=Path);a=p.parse_args();install(a.root)
|
||||
@@ -0,0 +1,98 @@
|
||||
# Qualified CPython 3.11 x86_64 CPU environment, 27 October 2026.
|
||||
addict==2.4.0
|
||||
annotated-doc==0.0.5
|
||||
annotated-types==0.7.0
|
||||
attrs==25.1.0
|
||||
babel==2.17.0
|
||||
blis==1.2.0
|
||||
catalogue==2.0.10
|
||||
certifi==2025.1.31
|
||||
cffi==2.0.0
|
||||
charset-normalizer==3.4.1
|
||||
click==8.1.8
|
||||
clldutils==3.21.0
|
||||
cloudpathlib==0.20.0
|
||||
cloudpickle==3.1.2
|
||||
colorama==0.4.6
|
||||
colorlog==6.9.0
|
||||
confection==0.1.5
|
||||
csvw==3.5.1
|
||||
curated-tokenizers==0.0.9
|
||||
curated-transformers==0.1.1
|
||||
cymem==2.0.11
|
||||
dlinfo==2.0.0
|
||||
docopt==0.6.2
|
||||
espeakng-loader==0.2.4
|
||||
filelock==3.17.0
|
||||
fsspec==2025.2.0
|
||||
huggingface-hub==0.28.1
|
||||
idna==3.10
|
||||
isodate==0.7.2
|
||||
jinja2==3.1.5
|
||||
joblib==1.4.2
|
||||
jsonschema==4.23.0
|
||||
jsonschema-specifications==2024.10.1
|
||||
kokoro @ git+https://github.com/semidark/kokoro@b96fef95e6a746495f92443fac7c688f90fc57fc
|
||||
langcodes==3.5.0
|
||||
language-data==1.3.0
|
||||
language-tags==1.2.0
|
||||
loguru==0.7.3
|
||||
lxml==5.3.1
|
||||
marisa-trie==1.2.1
|
||||
markdown==3.7
|
||||
markdown-it-py==3.0.0
|
||||
markupsafe==3.0.2
|
||||
mdurl==0.1.2
|
||||
misaki[en,de] @ git+https://github.com/semidark/misaki@6d252a2e02f3b030f22f56686f1a73786c16ffc8
|
||||
mpmath==1.3.0
|
||||
murmurhash==1.0.12
|
||||
networkx==3.6.1
|
||||
num2words==0.5.14
|
||||
numpy==1.26.4
|
||||
packaging==24.2
|
||||
phonemizer-fork==3.3.2
|
||||
pip==26.0.1
|
||||
preshed==3.0.9
|
||||
pycparser==3.0
|
||||
pydantic==2.10.6
|
||||
pydantic-core==2.27.2
|
||||
pygments==2.19.1
|
||||
pylatexenc==2.10
|
||||
pyparsing==3.2.1
|
||||
python-dateutil==2.9.0.post0
|
||||
pyyaml==6.0.2
|
||||
rdflib==7.1.3
|
||||
referencing==0.36.2
|
||||
regex==2024.11.6
|
||||
requests==2.32.3
|
||||
rfc3986==1.5.0
|
||||
rich==13.9.4
|
||||
rpds-py==0.22.3
|
||||
safetensors==0.5.2
|
||||
segments==2.2.1
|
||||
setuptools==75.8.0
|
||||
shellingham==1.5.4
|
||||
six==1.17.0
|
||||
smart-open==7.1.0
|
||||
soundfile==0.14.0
|
||||
spacy==3.8.4
|
||||
spacy-curated-transformers==0.3.0
|
||||
spacy-legacy==3.0.12
|
||||
spacy-loggers==1.0.5
|
||||
srsly==2.5.1
|
||||
sympy==1.13.1
|
||||
tabulate==0.9.0
|
||||
termcolor==3.3.0
|
||||
thinc==8.3.4
|
||||
tokenizers==0.21.0
|
||||
torch==2.6.0+cpu
|
||||
tqdm==4.67.1
|
||||
transformers==4.48.3
|
||||
typer==0.15.1
|
||||
typing-extensions==4.12.2
|
||||
tzdata==2026.5
|
||||
uritemplate==4.1.1
|
||||
urllib3==2.3.0
|
||||
wasabi==1.1.3
|
||||
weasel==0.4.1
|
||||
wrapt==1.17.2
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Scoped real CPU worker test with synthetic text; no production request/switch."""
|
||||
import argparse,hashlib,json,time,wave
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
|
||||
from kikiri_runtime import KikiriRuntime,REPO,MODEL_REVISION,MODEL_FILE,MODEL_SHA
|
||||
from kikiri import Kikiri
|
||||
|
||||
def verify(state):
|
||||
state=Path(state);root=state/'kikiri-verification-jobs'
|
||||
root.mkdir(exist_ok=True,mode=0o700)
|
||||
watched=('profiles.json','endpoint.json','audio-policy.json','cpu-partition.json')
|
||||
def hashes():return {n:hashlib.sha256((state/n).read_bytes()).hexdigest() for n in watched if (state/n).is_file()}
|
||||
before=hashes();runtime=KikiriRuntime(state/'kikiri-runtime');assert runtime.status()['installed']
|
||||
model=dict(kind='audio',repo=REPO,revision=MODEL_REVISION,file=MODEL_FILE,sha256=MODEL_SHA)
|
||||
row=dict(id='c'*32,revision=1,runnable=True,parameters={'speed':1},model=model)
|
||||
worker=Kikiri(root,SimpleNamespace(status=lambda:{'profiles':[row]}),runtime)
|
||||
cases={
|
||||
'expressive':'Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.',
|
||||
'technical':'Home Assistant läuft auf Unraid. Der Docker-Container meldet 47 Grad. Im Logfile stehen keine Fehler. Der freie Speicher beträgt 512 MiB. Die Verbindung liefert 100 Mbit pro Sekunde. Um 18:30 CEST beginnt der nächste Scan.'}
|
||||
results=[];began=time.monotonic()
|
||||
try:
|
||||
for case,text in cases.items():
|
||||
if case=='technical':
|
||||
from tts_text_enhancer import prepare
|
||||
text=prepare(text,'German')
|
||||
job=worker.start(row['id'],text,streaming=True);deadline=time.monotonic()+150
|
||||
while True:
|
||||
current=worker.job_status(job['id'])
|
||||
if current['state']!='running':break
|
||||
if time.monotonic()>deadline:raise RuntimeError('Own worker test timed out')
|
||||
time.sleep(.1)
|
||||
assert current['state']=='complete',current['phase']
|
||||
directory=root/job['id'];pcm=b''.join(p.read_bytes() for p in sorted(directory.glob('chunk-*.pcm')))
|
||||
with wave.open(str(directory/'result.wav')) as w:
|
||||
assert (w.getframerate(),w.getnchannels(),w.getsampwidth())==(24000,1,2)
|
||||
assert w.readframes(w.getnframes())==pcm
|
||||
item={k:current[k] for k in ('id','duration','sample_rate','seconds','first_chunk_seconds')}
|
||||
item.update(case=case,rtf=current['seconds']/current['duration'],pcm_matches_wav=True)
|
||||
results.append(item)
|
||||
finally:worker.stop()
|
||||
result=dict(complete=len(results)==2,runs=results,wall_seconds=time.monotonic()-began,
|
||||
production_config_unchanged=before==hashes(),own_worker_stopped=worker.process is None)
|
||||
(root/'verification.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
print(json.dumps(result),flush=True)
|
||||
assert result['complete'] and result['production_config_unchanged']
|
||||
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('--state',required=True,type=Path);a=p.parse_args();verify(a.state)
|
||||
@@ -23,11 +23,11 @@ def key():
|
||||
return KEY.read_bytes().strip()+b'\n'
|
||||
|
||||
def sources():
|
||||
names=('articulino-jobs','seedvc-jobs','humaneness-jobs','qwen-native-jobs','speech-voices','pocket-jobs','soulx_singer-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests')
|
||||
names=('kikiri-data','kikiri-jobs','articulino-jobs','seedvc-jobs','humaneness-jobs','qwen-native-jobs','speech-voices','pocket-jobs','soulx_singer-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests')
|
||||
roots=[(STATE/n,'deck/'+n) for n in names]+[(STATE/'video/original-work/outputs','deck/video/original-work/outputs'),(STATE/'video/original-work/remote-inputs','deck/video/original-work/remote-inputs'),(STATE/'video/original-work/deskweb','deck/video/original-work/deskweb'),(Path('/opt/athena-ladypoly/data'),'services/ladypoly'),(Path('/opt/athena-deck-docker-apps'),'services/web-studios')]
|
||||
# Private locally-trained voices have no public replacement source.
|
||||
for p in (STATE/'models').glob('*/entry.json'):
|
||||
if json.loads(p.read_text()).get('repo','').startswith('local/mikes-applio'):roots.append((p.parent,'deck/models/'+p.parent.name))
|
||||
if json.loads(p.read_text()).get('repo','').startswith(('local/mikes-applio','local/kikiri-anna')):roots.append((p.parent,'deck/models/'+p.parent.name))
|
||||
return roots
|
||||
|
||||
def files(roots):
|
||||
|
||||
Reference in new issue
Block a user