From c15f24e36bdd4b4261cfbaf8d7620064af36b35a Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:31:57 +0100 Subject: [PATCH] Document isolated Kikiri Anna fine-tune and CPU speech evaluation --- .../kikiri-anna-training-2026-10-27/README.md | 168 +++++++++++ .../asset-manifest.json | 28 ++ .../base-components.json | 54 ++++ .../benchmark.py | 108 +++++++ .../control.py | 32 +++ .../data-summary.json | 20 ++ .../export.json | 39 +++ .../kikiri-anna-training-2026-10-27/export.py | 44 +++ .../final-verification.json | 10 + .../prepare.py | 62 ++++ .../prepare_data.py | 45 +++ .../quality.json | 232 +++++++++++++++ .../kikiri-anna-training-2026-10-27/score.py | 36 +++ .../speed.json | 271 ++++++++++++++++++ .../support.py | 37 +++ .../kikiri-anna-training-2026-10-27/train.py | 102 +++++++ .../training-first.json | 80 ++++++ .../training-requirements-resolved.txt | 89 ++++++ .../training-second.json | 63 ++++ .../transcriptions.json | 14 + .../kikiri-anna-training-2026-10-27/verify.py | 21 ++ .../tts-candidate-shortlist-2026-10-27.md | 3 +- 22 files changed, 1557 insertions(+), 1 deletion(-) create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/README.md create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/asset-manifest.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/base-components.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/benchmark.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/control.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/data-summary.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/export.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/export.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/final-verification.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/prepare.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/prepare_data.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/quality.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/score.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/speed.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/support.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/train.py create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/training-first.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/training-requirements-resolved.txt create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/training-second.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/transcriptions.json create mode 100644 docs/experiments/kikiri-anna-training-2026-10-27/verify.py diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/README.md b/docs/experiments/kikiri-anna-training-2026-10-27/README.md new file mode 100644 index 0000000..8fd4e74 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/README.md @@ -0,0 +1,168 @@ +# Kokoro/Kikiri Anna adaptation · 27 October 2026 + +Michael authorized training on the supplied `Anna Training.wav`, followed by +the unchanged technical paragraph on Athena CPU, local STT and a listening +sample. This is an isolated pilot. The active Articulino TTS must not change. + +## Fixed pilot protocol + +- Own private root `/data/athena-kikiri-anna-20261027`, mode 0700. No private + recordings, per-clip transcripts, caches or trained weights in Git/cloud. +- Reuse the previously prepared Anna recording segments from the Piper pilot; + do not delete or alter that earlier root. Automatic local ASR transcripts + are not manually certified ground truth. Original recording unchanged. +- 63 training segments / 731.265 s, six validation / 68.215 s, seven held-out / + 82.55 s. Mono PCM16 at 24 kHz using SciPy's polyphase resampler. Held-out + audio is excluded from both training and voicepack extraction. +- Pinned Kikiri source `a12d0410e89841e6f3c09958ae5c072f90ae1d49`, StyleTTS2 + `b1956da84bf4a6ccc88f2440078024f1c4bfec7d`. German base is + `kikiri-tts/kikiri-german-base-51speakers-synthetic`, revision + `0d15d026c94423b00bbdfc6644b0910c8daa29a9`, full Stage 1 checkpoint. The + guide's other HUI base URL was inaccessible (HTTP 401); no restricted token + or private download was attempted. This base is also Victoria's parent. +- Existing independently installed CPython 3.11.18 is an explicit read-only + dependency from the Victoria experiment; own CUDA training venv. Torch + 2.7.1+cu128 / torchaudio 2.7.1, transformers 4.48.3, separate from Hermes, + Deck, and the existing CPU inference venv. Actual package list and public + model/checkpoint hashes recorded separately. +- Ten Stage 1 epochs, twelve Stage 2 epochs, batch two, max 200 mel frames in + Stage 1 / 160 in Stage 2, float32, learning rates 5e-5 / BERT 5e-6, seed 20261027. + Stage 2 starts from the new Stage 1 with fresh optimizers, joint_epoch=3, + lambda_slm=1, diffusion disabled. Keep all pretrained linguistic/predictor + weights. No parameter or sampling tuning based on evaluation outputs. +- Strictly check every loaded component. The expressly unused diffusion stub + is excluded because the multispeaker base has extra conditioning tensors. + Keep the new weight-norm API. Pilot checkpoints omit Adam moments; they are + weight-only exports, not a complete resumable optimizer state. +- One RTX 5080 selected by UUID; transient native units, CPU quota 500%, nice + 10, RAM cap 14 GiB, no swap/network, writable own root only. No host package + install, container dependency, new permanent service or production restart. +- Pause the twelve previously offered chat profiles via authenticated Deck UI, + confirm zero running/waiting requests, then regular `Modell entladen`. + TTS/STT publication stays unchanged. Restore exactly those chat profiles and + reload the original `flash-next-strata-iq3-dual` after success or failure. + +## Preparation findings + +The initial alignment build selected unavailable Clang from standalone +Python's build defaults; explicit existing GCC/G++ fixed it. Data preparation +needed SciPy absent from the old CPU venv; it reads SciPy from the new training +venv without altering the old one. All 76 accepted clips passed the fixed +Kokoro IPA mapping (`ʏ` → `y`, 178-token vocabulary) and length validation. + +A strict initial training load stopped on the unused diffusion conditioning +tensors, before optimization. Those are now explicitly excluded. Batch four +in float32 exceeded 16 GB VRAM on the first generator backward pass; the +pilot restarted from the public base with batch two. No failed partial +checkpoint was used as a training result. + +An additional upstream small-batch issue was found before final audio was +evaluated: `SLMAdversarialLoss` selects half of batch two (one example), then +returns `None` for fewer than two examples. Thus the extra out-of-distribution +SLM adversarial branch never runs under that default; waveform GAN and WavLM +feature matching still run. The own first Stage 2 attempt was stopped and +restarted **from Stage 1**, selecting both examples (`batch_percentage=1`) and +limiting main/SLM crops to 160 frames to bound VRAM. This correction is not an +output-driven pronunciation adjustment. Final optimizer counters must confirm +that the extra WavLM discriminator actually receives updates. + +## Reproduction and preservation + +`prepare.py` installs only into this root, fetching pinned public assets. +It requires native Git, GCC/G++, CA certificates and the documented standalone +Python/uv from the preceding Victoria recipe (or independently reproduce that +runtime). The resemble-ai alignment revision is in the asset manifest. The +training model source includes its ASR, JDC and PLBERT utility weights; their +source is the pinned source tree. This is not a production installer or a +tested complete encrypted restore. An accepted private voice would need +explicit inclusion in the normal encrypted restore data; no unsolicited +backup is made here. + +`prepare_data.py` writes only derived private data in this root. `train.py` +uses the official two-stage scripts with strict loading and bounded native +units. `export.py` loads encoders strictly, in evaluation mode, taking timbre +from Stage 1 and prosody from Stage 2 as recommended by the project. It +averages only training clips, then exports the five Kokoro inference components +and a `[510, 1, 256]` Anna voicepack. `benchmark.py` reuses the verified CPU-only +Torch/German G2P environment with four threads and original raw evaluation +texts. `score.py` uses the existing local Parakeet CPU CLI. No cloud evaluator. + +The exact technical text is in `quality.json`. It must not receive an extra +technical pronunciation lexicon for this comparison. CPU speed is actual +generation wall time divided by actual audio duration, excluding model load +and WAV writing. STT is a diagnostic proxy, not a voice-identity assessment. +Human listening decides whether this resembles Anna. + +Sources: [Kikiri training guide](https://github.com/semidark/kikiri-tts/blob/a12d0410e89841e6f3c09958ae5c072f90ae1d49/docs/TRAINING_GUIDE.md), +[German base model](https://huggingface.co/kikiri-tts/kikiri-german-base-51speakers-synthetic), +[patched StyleTTS2](https://github.com/semidark/StyleTTS2/tree/b1956da84bf4a6ccc88f2440078024f1c4bfec7d). + +## Observed final result + +Both corrected phases completed on the RTX 5080, with finite final inference +weights. Stage 1: **214.42 s / 310 batches**, validation mel loss 0.29918; +Stage 2: **273.22 s / 372 batches**, validation mel loss 0.43826. Total successful +training phases: **487.64 s (8 min 8 s)**, excluding setup, failed starts and +the stopped first Stage 2 attempt. These are different stage objectives, not +a before/after quality score. Stage 2's WavLM discriminator received 27 actual +optimizer calls; the extra generator branch ran 279 times. `diffusion` step +calls are upstream no-gradient calls, not proof of trained diffusion. +Peak Torch allocation: Stage 1 9.39 GiB, Stage 2 12.13 GiB; peak reserved +10.24 / 12.97 GiB. No trainer remains. + +The exported 81.8M-parameter inference model is **327,187,339 bytes** and its +Anna voicepack 523,732 bytes. Timbre/prosody embedding norms are 1.7697 / 3.0948; +all 63 training clips were used, no held-out clips. They and all trained weights +remain in the private test root, now about 13 GiB. No endpoint profile created. + +The first export completed its model/voice files but failed serializing a +scalar Torch validation loss into JSON. Casting scalar report values to +ordinary numbers and rerunning export fixed the report; no retraining or +speech tuning resulted. Initial CPU harness imports exposed a lazy +Torch/Transformers import error; explicitly initializing Torch's lazy module +revealed the restricted unit's absent writable temp directory. An own TMPDIR +fixed it. An overbroad template rename of the public config path was also +caught and corrected before any successful render. These setup failures are +not scored as speed/quality results; no production packages were changed. + +CPU-only Torch 2.6.0, four threads, same CPU affinity/400% quota as Victoria, +3 GiB RAM cap, no GPU devices/network, Qwen resident again. One reported +warmup, then two story renders; technical sample in a fresh process, with +no extra pronunciation lexicon or production enhancer. + +| CPU case | Audio | Generation | RTF | Realtime multiple | +| --- | ---: | ---: | ---: | ---: | +| Story 1 | 16.45 s | 5.315 s | 0.3231 | 3.10× | +| Story 2 | 16.45 s | 4.724 s | 0.2872 | 3.48× | +| Same raw technical paragraph | **20.175 s** | **6.840 s** | **0.3390** | **2.95×** | + +The two story files have identical hashes. Technical model/voice preparation +was 0.775 s (separate from generation); first complete audio chunk arrived +after 6.840 s. This implementation yields a whole paragraph, not low-latency +streaming frames. Technical process peak RSS about 1.33 GiB; unit peak 1.3 GiB, +no swap, peak amplitude 0.501, no clipping, no dropped/truncated phonemes. +WAV is 24 kHz mono PCM16. Local/remote SHA-256 match: +`2f84113d25666a7910739241fa8b608b19512b7c258bb52ef7ec4f177657ca23`. + +Local Parakeet STT (1.540 s) recovered the entire paragraph, all quantities +and the time, with lexical deviations: `Homa Assistant`, `Unreid`, +`Lockfiele`, `512 MB`, `18.30 Uhr Kest`, `Scarn`. Raw alignment has seven edits +in forty reference tokens, including the legitimate expansion `Uhr`; this is +not a certified 17.5% TTS error rate. The phoneme trace directly confirms the +frontend's German-word treatment of Home, Logfile and CEST. German technical +pronunciation remains imperfect, independent of whether the adapted voice +sounds like Anna. **No human Anna-identity/naturalness acceptance yet.** + +Qwen was restored through an ordinary authenticated completion request, +which returned choices. `final-verification.json`: all original production +file hashes match (profile catalogue, endpoint, CPU/audio policies, original +Anna reference, canonical Qwen worker source); CPU TTS worker PIDs and Deck +start time match. The previous `flash-next-strata-iq3-dual` is running again; +all twelve original chat publications restored, TTS/STT remained active, no +new test worker left. Mac apps, Hermes and active TTS unchanged. Native +Hermes/Conduit playback of this pilot is untested. The saved local screenshot +also shows restored Qwen and the unchanged active speech services. + +Listening WAVs are outside Git in local +`work/kikiri-anna-training-20261027/audio/`. The report records actual pilot +results, not a production integration or proof of superiority to Sopro B. diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/asset-manifest.json b/docs/experiments/kikiri-anna-training-2026-10-27/asset-manifest.json new file mode 100644 index 0000000..1db3759 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/asset-manifest.json @@ -0,0 +1,28 @@ +{ + "base_repo": "kikiri-tts/kikiri-german-base-51speakers-synthetic", + "base_revision": "0d15d026c94423b00bbdfc6644b0910c8daa29a9", + "base_file": "stage1_ep4_raw.pth", + "base_sha256": "4670aa69d2dcdeb7236d175d19413d6cb547aeadfbe58c4ea56d0e5b50f17511", + "styletts_revision": "b1956da84bf4a6ccc88f2440078024f1c4bfec7d", + "align_revision": "c6e5e6cb19882164027eb6e35118e841eed9298e", + "wavlm_repo": "microsoft/wavlm-base-plus", + "wavlm_revision": "4c66d4806a428f2e922ccfa1a962776e232d487b", + "wavlm_files": [ + { + "file": "config.json", + "sha256": "fea6df1c2700a3954fc07e70588aecc9055eeb28db2ff57151a2db0d19180ed4", + "bytes": 2232 + }, + { + "file": "preprocessor_config.json", + "sha256": "99272fe8ccfab114b68b478681ea47ee3a1ce62bb788cb92dd6e4f69fb1f1da2", + "bytes": 215 + }, + { + "file": "pytorch_model.bin", + "sha256": "3bb273a6ace99408b50cfc81afdbb7ef2de02da2eab0234e18db608ce692fe51", + "bytes": 377617425 + } + ], + "python_runtime": "/data/athena-kikiri-victoria-cpu-20261027/python/bin/python3.11" +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/base-components.json b/docs/experiments/kikiri-anna-training-2026-10-27/base-components.json new file mode 100644 index 0000000..5579855 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/base-components.json @@ -0,0 +1,54 @@ +{ + "bert": { + "tensors": 25, + "parameters": 6292480 + }, + "bert_encoder": { + "tensors": 2, + "parameters": 393728 + }, + "predictor": { + "tensors": 122, + "parameters": 16194612 + }, + "decoder": { + "tensors": 375, + "parameters": 53276190 + }, + "text_encoder": { + "tensors": 24, + "parameters": 5606400 + }, + "predictor_encoder": { + "tensors": 67, + "parameters": 13880813 + }, + "style_encoder": { + "tensors": 67, + "parameters": 13880813 + }, + "diffusion": { + "tensors": 96, + "parameters": 50653952 + }, + "text_aligner": { + "tensors": 143, + "parameters": 7868452 + }, + "pitch_extractor": { + "tensors": 77, + "parameters": 5251148 + }, + "mpd": { + "tensors": 90, + "parameters": 41105770 + }, + "msd": { + "tensors": 54, + "parameters": 280902 + }, + "wd": { + "tensors": 15, + "parameters": 1173634 + } +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/benchmark.py b/docs/experiments/kikiri-anna-training-2026-10-27/benchmark.py new file mode 100644 index 0000000..4638ee4 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/benchmark.py @@ -0,0 +1,108 @@ +"""Speed first, then the original technical paragraph; Trained Anna only, CPU only.""" +import os +from pathlib import Path +ROOT=Path('/data/athena-kikiri-anna-20261027') +PUBLIC=Path('/data/athena-kikiri-victoria-cpu-20261027') +(ROOT/'tmp').mkdir(exist_ok=True,mode=0o700) +os.environ.update(CUDA_VISIBLE_DEVICES='',HF_HUB_OFFLINE='1',HF_HUB_DISABLE_TELEMETRY='1',HF_HUB_DISABLE_IMPLICIT_TOKEN='1', + HF_HOME=str(ROOT/'cache/huggingface'),XDG_CACHE_HOME=str(ROOT/'cache'),OMP_NUM_THREADS='4',MKL_NUM_THREADS='4', + OPENBLAS_NUM_THREADS='1',TOKENIZERS_PARALLELISM='false',TMPDIR=str(ROOT/'tmp')) +import argparse +import hashlib +import json +import random +import resource +import time +import numpy as np +import soundfile as sf +import torch +import torch._dynamo # Initialize Torch's lazy module before Transformers 4.48. +from kokoro import KModel,KPipeline +from misaki.de import normalize_text_de +from support import CASES,available,write,preservation + +def seed():random.seed(42);np.random.seed(42);torch.manual_seed(42) + +def main(): + parser=argparse.ArgumentParser();parser.add_argument('phase',choices=['speed','quality']);args=parser.parse_args() + os.umask(0o077);torch.set_num_threads(4);torch.set_num_interop_threads(1);os.sched_setaffinity(0,{2,3,4,5,8,9,10,11}) + assert torch.version.cuda is None and not torch.cuda.is_available() + assert available()>=3*1024**3 + target=ROOT/(args.phase+'.json');assert not target.exists() + if args.phase=='quality':assert json.loads((ROOT/'speed.json').read_text())['gate_passed'] + (ROOT/'outputs').mkdir(exist_ok=True,mode=0o700) + data=dict(phase='loading',runs=[],protocol=dict(device='cpu',voice='Anna pilot',cpu_threads=4,interop_threads=1, + affinity=sorted(os.sched_getaffinity(0)),precision='fp32',seed=42,speed=1,gate_maximum_rtf=.5, + german_frontend='Kikiri lockfile Misaki DEG2P',compatibility_map={'ʏ':'y'},cpu_quota_percent=400, + memory_max_gib=3,concurrent_llm_load_added=False),torch=torch.__version__) + write(target,data);seed();start=time.monotonic() + model=KModel(repo_id='hexgrad/Kokoro-82M',config=str(PUBLIC/'source/training/config.json'), + model=str(ROOT/'model/anna.pth')).to('cpu').eval() + # The fork enables affine InstanceNorm only for ONNX compatibility; original + # checkpoints omit those identity constants. Verify this exact exception, + # then strictly reload the complete state instead of trusting a broad fallback. + weights=torch.load(ROOT/'model/anna.pth',map_location='cpu',weights_only=True) + strict=[] + for name,state in weights.items(): + component=getattr(model,name) + normalized={k.removeprefix('module.'):v for k,v in state.items()} + check=component.load_state_dict(normalized,strict=False) + assert not check.unexpected_keys,(name,check.unexpected_keys) + current=component.state_dict() + for key in check.missing_keys: + module_path,parameter=key.rsplit('.',1);layer=component.get_submodule(module_path) + assert isinstance(layer,torch.nn.InstanceNorm1d) and layer.affine + assert parameter in ['weight','bias'] + expected=1 if parameter=='weight' else 0 + assert torch.all(current[key]==expected),(name,key) + normalized[key]=current[key] + component.load_state_dict(normalized,strict=True) + strict.append(dict(component=name,identity_affine_keys=check.missing_keys)) + del weights + pipeline=KPipeline(lang_code='d',repo_id='hexgrad/Kokoro-82M',model=model,device='cpu') + original=pipeline.g2p + # Kokoro's documented German symbol compatibility mapping, fixed before any output. + def compatible(text): + ps,tokens=original(text) + return ps.replace('ʏ','y'),tokens + pipeline.g2p=compatible + voice=torch.load(ROOT/'model/anna.pt',map_location='cpu',weights_only=True) + assert voice.ndim==3 and voice.shape[-1]==256 and torch.isfinite(voice).all() + assert all(p.device.type=='cpu' for p in model.parameters()) + data.update(model_load_seconds=time.monotonic()-start,strict_components=strict, + parameters=sum(p.numel() for p in model.parameters()),voice_shape=list(voice.shape)) + def synthesize(text,name,save=True): + assert available()>=2*1024**3 + seed();chunks=[];first=None;phonemes=[];start=time.monotonic() + for result in pipeline(text,voice=voice,speed=1): + if first is None:first=time.monotonic()-start + assert len(result.phonemes)<=510,'Upstream phoneme truncation would invalidate this test' + audio=result.audio.detach().cpu().numpy().reshape(-1) + assert len(audio) and np.isfinite(audio).all() + chunks.append(audio);phonemes.append(result.phonemes) + elapsed=time.monotonic()-start + assert chunks + pcm=np.concatenate(chunks);duration=len(pcm)/24000 + row=dict(file=name if save else None,text=text,normalized_text=normalize_text_de(text),generation_seconds=elapsed, + duration_seconds=duration,rtf=elapsed/duration,realtime_multiple=duration/elapsed,first_complete_chunk_seconds=first, + chunks=len(chunks),phonemes=phonemes,dropped_phonemes=sorted({c for p in phonemes for c in p if c not in model.vocab}), + peak=float(np.max(np.abs(pcm))),clipped_fraction=float(np.mean(np.abs(pcm)>=1)), + peak_rss_kib=resource.getrusage(resource.RUSAGE_SELF).ru_maxrss) + if save: + path=ROOT/'outputs'/name;sf.write(path,pcm,24000,subtype='PCM_16');row['sha256']=hashlib.file_digest(path.open('rb'),'sha256').hexdigest() + return row + if args.phase=='speed': + # Explicit warmup is reported separately; both subsequent full story renders must pass. + data['warmup']=synthesize('Die Sprachausgabe ist bereit.','warmup.wav',False) + work=[(CASES[0],1),(CASES[0],2)] + else:work=[(CASES[1],1)] + for case,rep in work: + row=synthesize(case['text'],f'kikiri-anna-{args.phase}-{case["id"]}-{rep}.wav');row.update(case=case['id'],repetition=rep) + data['runs'].append(row);data['phase']='running';write(target,data);print(json.dumps(row,ensure_ascii=False),flush=True) + if args.phase=='speed' and row['rtf']>.5:data.update(phase='speed_rejected',gate_passed=False);break + else:data.update(phase='complete',gate_passed=True) + data['weighted_rtf']=sum(r['generation_seconds'] for r in data['runs'])/sum(r['duration_seconds'] for r in data['runs']) + data['production_preservation']=preservation();write(target,data) + print(json.dumps(dict(phase=data['phase'],gate_passed=data['gate_passed'],weighted_rtf=data['weighted_rtf'],preservation=data['production_preservation'])),flush=True) + +if __name__=='__main__':main() diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/control.py b/docs/experiments/kikiri-anna-training-2026-10-27/control.py new file mode 100644 index 0000000..6a2b019 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/control.py @@ -0,0 +1,32 @@ +"""Authenticated observation and final reload. Credential only arrives on stdin.""" +from pathlib import Path +import hashlib, json, sys, time, urllib.request +ROOT=Path('/data/athena-kikiri-anna-20261027') +PUBLIC=Path('/data/athena-kikiri-victoria-cpu-20261027') +sys.path.insert(0,str(PUBLIC)) +from support import snapshot +key=json.load(sys.stdin)['api_key'] +def request(path,body=None,port=8108): + data=None if body is None else json.dumps(body).encode() + req=urllib.request.Request(f'http://127.0.0.1:{port}'+path,data=data, + headers={'Authorization':'Bearer '+key,'Content-Type':'application/json'}) + with urllib.request.urlopen(req,timeout=600) as f:return json.load(f) +def safe_status(): + e=request('/api/v1/status')['endpoint'] + return {k:e.get(k) for k in ('state','active_requests','scheduler','requests_running','requests_queued')} +mode=sys.argv[1] +if mode=='before': + before=snapshot() + worker=json.loads(Path('/opt/athena-deck-dev/runtime/state/strata-worker/worker.json').read_text()) + before['previous_profile']=worker['model_name'] + (ROOT/'production-before.json').write_text(json.dumps(before,indent=2)) + print(json.dumps(dict(previous_profile=before['previous_profile'],status=safe_status()))) +elif mode=='status':print(json.dumps(safe_status())) +elif mode=='restore': + before=json.loads((ROOT/'production-before.json').read_text()) + status=safe_status() + while status.get('active_requests'): + time.sleep(3);status=safe_status() + result=request('/v1/chat/completions',dict(model=before['previous_profile'],messages=[{'role':'user','content':'Antworte mit OK.'}], + max_tokens=1,temperature=0,reasoning_effort='none'),8120) + print(json.dumps(dict(choices_present=bool(result.get('choices')),status=safe_status()))) diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/data-summary.json b/docs/experiments/kikiri-anna-training-2026-10-27/data-summary.json new file mode 100644 index 0000000..b7c1f87 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/data-summary.json @@ -0,0 +1,20 @@ +{ + "counts": { + "train": 63, + "val": 6, + "heldout": 7 + }, + "seconds": { + "train": 731.265, + "val": 68.215, + "heldout": 82.55000000000001 + }, + "rejected": [], + "source": "Previously segmented original Anna Training.wav; local ASR transcripts, not manually certified", + "rate": 24000, + "pcm": "mono PCM16", + "phoneme_map": { + "\u028f": "y" + }, + "heldout_never_trained": true +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/export.json b/docs/experiments/kikiri-anna-training-2026-10-27/export.json new file mode 100644 index 0000000..01b674a --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/export.json @@ -0,0 +1,39 @@ +{ + "training_summary": { + "first_epoch": 9, + "first_iters": 310, + "first_val_loss": 0.29917870958646137, + "second_epoch": 11, + "second_iters": 372, + "second_val_loss": 0.43826210498809814 + }, + "training_clips": 63, + "voice_shape": [ + 510, + 1, + 256 + ], + "acoustic_norm": 1.7697334289550781, + "prosodic_norm": 3.0947821140289307, + "acoustic_source": "Stage 1 final", + "prosodic_source": "Stage 2 final", + "export_components": [ + "bert", + "bert_encoder", + "predictor", + "decoder", + "text_encoder" + ], + "files": [ + { + "file": "anna.pth", + "bytes": 327187339, + "sha256": "4c338c80196b7cd7310af2cf9134c794703a80ffa2e15d875beb173db3af68a2" + }, + { + "file": "anna.pt", + "bytes": 523732, + "sha256": "aec10d3d0e0c7769d530366e1523c80932d2ce75935e95d93441e327da80e4ad" + } + ] +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/export.py b/docs/experiments/kikiri-anna-training-2026-10-27/export.py new file mode 100644 index 0000000..73fe74a --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/export.py @@ -0,0 +1,44 @@ +"""Strict CPU export and training-only Anna voicepack; no production writes.""" +from pathlib import Path +import hashlib,json,os,sys +ROOT=Path('/data/athena-kikiri-anna-20261027') +PUBLIC=Path('/data/athena-kikiri-victoria-cpu-20261027') +os.environ.update(CUDA_VISIBLE_DEVICES='',HF_HUB_OFFLINE='1',OMP_NUM_THREADS='4',OPENBLAS_NUM_THREADS='1') +import numpy as np,soundfile as sf,torch,torchaudio +torch.set_num_threads(4);torch.set_num_interop_threads(1) +sys.path.insert(0,str(PUBLIC/'source/scripts')) +from extract_voicepack import StyleEncoder +os.umask(0o077);dest=ROOT/'model';dest.mkdir(exist_ok=True) +first=torch.load(ROOT/'run/first_stage.pth',map_location='cpu',weights_only=True) +second=torch.load(ROOT/'run/epoch_2nd_00011.pth',map_location='cpu',weights_only=True) +training_summary=dict(first_epoch=int(first['epoch']),first_iters=int(first['iters']),first_val_loss=float(first['val_loss']), + second_epoch=int(second['epoch']),second_iters=int(second['iters']),second_val_loss=float(second['val_loss'])) +def clean(state):return {k.removeprefix('module.'):v for k,v in state.items()} +names=('bert','bert_encoder','predictor','decoder','text_encoder') +weights={k:clean(second['net'][k]) for k in names} +assert all(torch.isfinite(t).all() for c in weights.values() for t in c.values() if t.is_floating_point()) +torch.save(weights,dest/'anna.pth') +encoders=[] +for checkpoint,name in [(first,'style_encoder'),(second,'predictor_encoder')]: + model=StyleEncoder(dim_in=64,style_dim=128,max_conv_dim=512) + model.load_state_dict(clean(checkpoint['net'][name]),strict=True) + model.eval();encoders.append(model) +del first,second,weights +mel=torchaudio.transforms.MelSpectrogram(sample_rate=24000,n_fft=2048,win_length=1200,hop_length=300,n_mels=80) +styles=[] +with torch.no_grad(): + for file in sorted((ROOT/'data/training-audio').glob('*.wav')): + pcm,sr=sf.read(file,dtype='float32');assert sr==24000 and pcm.ndim==1 + x=(torch.log(1e-5+mel(torch.from_numpy(pcm)[None]))+4)/4 + v=torch.cat([e(x[:,None]) for e in encoders],dim=-1) + assert torch.isfinite(v).all() and v.norm()<1000 + styles.append(v) +v=torch.cat(styles).mean(dim=0) +assert .5=40 and summary['counts']['val']>=4 +(ROOT/'data-summary.json').write_text(json.dumps(summary,indent=2)) +print(json.dumps(summary),flush=True) diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/quality.json b/docs/experiments/kikiri-anna-training-2026-10-27/quality.json new file mode 100644 index 0000000..e951141 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/quality.json @@ -0,0 +1,232 @@ +{ + "phase": "complete", + "runs": [ + { + "file": "kikiri-anna-quality-technical-1.wav", + "text": "Home Assistant läuft in Docker auf Unraid. Die SSD hat 47 Grad Celsius. Das Logfile enthält keinen Fehler. Die Datei ist 512 MiB groß und die Verbindung überträgt 100 Mbit pro Sekunde. Um 18:30 CEST startet der nächste Scan.", + "normalized_text": "Home Assistant läuft in Docker auf Unraid. Die SSD hat siebenundvierzig Grad Celsius. Das Logfile enthält keinen Fehler. Die Datei ist fünfhundertzwölf MiB groß und die Verbindung überträgt einhundert Mbit pro Sekunde. Um achtzehn Uhr dreißig CEST startet der nächste Scan.", + "generation_seconds": 6.839680047996808, + "duration_seconds": 20.175, + "rtf": 0.3390175984137203, + "realtime_multiple": 2.9496993804423375, + "first_complete_chunk_seconds": 6.839560874999734, + "chunks": 1, + "phonemes": [ + "hˈoːmə ˈasɪstˌɑːnt lˈɔøft ɪn dˈɔkɜ Wf ˈʊnrˌIt. diː ˌɛsˌɛsdˈeː hat zˈiːbənˌʊndviːɾʦˌɪç ɡɾˈɑːt ʦˈɛlziːˌʊs. das lɔkfˈiːlə ɛnthˈɛlt kˈInən fˈeːlɜ. diː datˈI ɪst fˈynfhʊndɜʦvˌœlf mˈiː bˈeː ɡɾˈoːs ʊnt diː fɛɾbˈɪndʊŋ ˌyːbɜtɾˈɛːkt ˈInhˌʊndɜt ˈɛmbˈiːt pɾoː zeːkˈʊndə. ʊm ˈaxʦeːn ˈuːɾ dɾˈIsɪç kˈɛst ʃtˈaɾtət dɛɾ nˈɛçstə skˈɑːn." + ], + "dropped_phonemes": [], + "peak": 0.5008490681648254, + "clipped_fraction": 0.0, + "peak_rss_kib": 1399060, + "sha256": "2f84113d25666a7910739241fa8b608b19512b7c258bb52ef7ec4f177657ca23", + "case": "technical", + "repetition": 1 + } + ], + "protocol": { + "device": "cpu", + "voice": "Anna pilot", + "cpu_threads": 4, + "interop_threads": 1, + "affinity": [ + 2, + 3, + 4, + 5, + 8, + 9, + 10, + 11 + ], + "precision": "fp32", + "seed": 42, + "speed": 1, + "gate_maximum_rtf": 0.5, + "german_frontend": "Kikiri lockfile Misaki DEG2P", + "compatibility_map": { + "ʏ": "y" + }, + "cpu_quota_percent": 400, + "memory_max_gib": 3, + "concurrent_llm_load_added": false + }, + "torch": "2.6.0+cpu", + "model_load_seconds": 0.7747855089983204, + "strict_components": [ + { + "component": "bert", + "identity_affine_keys": [] + }, + { + "component": "bert_encoder", + "identity_affine_keys": [] + }, + { + "component": "predictor", + "identity_affine_keys": [ + "F0.0.norm1.norm.weight", + "F0.0.norm1.norm.bias", + "F0.0.norm2.norm.weight", + "F0.0.norm2.norm.bias", + "F0.1.norm1.norm.weight", + "F0.1.norm1.norm.bias", + "F0.1.norm2.norm.weight", + "F0.1.norm2.norm.bias", + "F0.2.norm1.norm.weight", + "F0.2.norm1.norm.bias", + "F0.2.norm2.norm.weight", + "F0.2.norm2.norm.bias", + "N.0.norm1.norm.weight", + "N.0.norm1.norm.bias", + "N.0.norm2.norm.weight", + "N.0.norm2.norm.bias", + "N.1.norm1.norm.weight", + "N.1.norm1.norm.bias", + "N.1.norm2.norm.weight", + "N.1.norm2.norm.bias", + "N.2.norm1.norm.weight", + "N.2.norm1.norm.bias", + "N.2.norm2.norm.weight", + "N.2.norm2.norm.bias" + ] + }, + { + "component": "decoder", + "identity_affine_keys": [ + "encode.norm1.norm.weight", + "encode.norm1.norm.bias", + "encode.norm2.norm.weight", + "encode.norm2.norm.bias", + "decode.0.norm1.norm.weight", + "decode.0.norm1.norm.bias", + "decode.0.norm2.norm.weight", + "decode.0.norm2.norm.bias", + "decode.1.norm1.norm.weight", + "decode.1.norm1.norm.bias", + "decode.1.norm2.norm.weight", + "decode.1.norm2.norm.bias", + "decode.2.norm1.norm.weight", + "decode.2.norm1.norm.bias", + "decode.2.norm2.norm.weight", + "decode.2.norm2.norm.bias", + "decode.3.norm1.norm.weight", + "decode.3.norm1.norm.bias", + "decode.3.norm2.norm.weight", + "decode.3.norm2.norm.bias", + "generator.noise_res.0.adain1.0.norm.weight", + "generator.noise_res.0.adain1.0.norm.bias", + "generator.noise_res.0.adain1.1.norm.weight", + "generator.noise_res.0.adain1.1.norm.bias", + "generator.noise_res.0.adain1.2.norm.weight", + "generator.noise_res.0.adain1.2.norm.bias", + "generator.noise_res.0.adain2.0.norm.weight", + "generator.noise_res.0.adain2.0.norm.bias", + "generator.noise_res.0.adain2.1.norm.weight", + "generator.noise_res.0.adain2.1.norm.bias", + "generator.noise_res.0.adain2.2.norm.weight", + "generator.noise_res.0.adain2.2.norm.bias", + "generator.noise_res.1.adain1.0.norm.weight", + "generator.noise_res.1.adain1.0.norm.bias", + "generator.noise_res.1.adain1.1.norm.weight", + "generator.noise_res.1.adain1.1.norm.bias", + "generator.noise_res.1.adain1.2.norm.weight", + "generator.noise_res.1.adain1.2.norm.bias", + "generator.noise_res.1.adain2.0.norm.weight", + "generator.noise_res.1.adain2.0.norm.bias", + "generator.noise_res.1.adain2.1.norm.weight", + "generator.noise_res.1.adain2.1.norm.bias", + "generator.noise_res.1.adain2.2.norm.weight", + "generator.noise_res.1.adain2.2.norm.bias", + "generator.resblocks.0.adain1.0.norm.weight", + "generator.resblocks.0.adain1.0.norm.bias", + "generator.resblocks.0.adain1.1.norm.weight", + "generator.resblocks.0.adain1.1.norm.bias", + "generator.resblocks.0.adain1.2.norm.weight", + "generator.resblocks.0.adain1.2.norm.bias", + "generator.resblocks.0.adain2.0.norm.weight", + "generator.resblocks.0.adain2.0.norm.bias", + "generator.resblocks.0.adain2.1.norm.weight", + "generator.resblocks.0.adain2.1.norm.bias", + "generator.resblocks.0.adain2.2.norm.weight", + "generator.resblocks.0.adain2.2.norm.bias", + "generator.resblocks.1.adain1.0.norm.weight", + "generator.resblocks.1.adain1.0.norm.bias", + "generator.resblocks.1.adain1.1.norm.weight", + "generator.resblocks.1.adain1.1.norm.bias", + "generator.resblocks.1.adain1.2.norm.weight", + "generator.resblocks.1.adain1.2.norm.bias", + "generator.resblocks.1.adain2.0.norm.weight", + "generator.resblocks.1.adain2.0.norm.bias", + "generator.resblocks.1.adain2.1.norm.weight", + "generator.resblocks.1.adain2.1.norm.bias", + "generator.resblocks.1.adain2.2.norm.weight", + "generator.resblocks.1.adain2.2.norm.bias", + "generator.resblocks.2.adain1.0.norm.weight", + "generator.resblocks.2.adain1.0.norm.bias", + "generator.resblocks.2.adain1.1.norm.weight", + "generator.resblocks.2.adain1.1.norm.bias", + "generator.resblocks.2.adain1.2.norm.weight", + "generator.resblocks.2.adain1.2.norm.bias", + "generator.resblocks.2.adain2.0.norm.weight", + "generator.resblocks.2.adain2.0.norm.bias", + "generator.resblocks.2.adain2.1.norm.weight", + "generator.resblocks.2.adain2.1.norm.bias", + "generator.resblocks.2.adain2.2.norm.weight", + "generator.resblocks.2.adain2.2.norm.bias", + "generator.resblocks.3.adain1.0.norm.weight", + "generator.resblocks.3.adain1.0.norm.bias", + "generator.resblocks.3.adain1.1.norm.weight", + "generator.resblocks.3.adain1.1.norm.bias", + "generator.resblocks.3.adain1.2.norm.weight", + "generator.resblocks.3.adain1.2.norm.bias", + "generator.resblocks.3.adain2.0.norm.weight", + "generator.resblocks.3.adain2.0.norm.bias", + "generator.resblocks.3.adain2.1.norm.weight", + "generator.resblocks.3.adain2.1.norm.bias", + "generator.resblocks.3.adain2.2.norm.weight", + "generator.resblocks.3.adain2.2.norm.bias", + "generator.resblocks.4.adain1.0.norm.weight", + "generator.resblocks.4.adain1.0.norm.bias", + "generator.resblocks.4.adain1.1.norm.weight", + "generator.resblocks.4.adain1.1.norm.bias", + "generator.resblocks.4.adain1.2.norm.weight", + "generator.resblocks.4.adain1.2.norm.bias", + "generator.resblocks.4.adain2.0.norm.weight", + "generator.resblocks.4.adain2.0.norm.bias", + "generator.resblocks.4.adain2.1.norm.weight", + "generator.resblocks.4.adain2.1.norm.bias", + "generator.resblocks.4.adain2.2.norm.weight", + "generator.resblocks.4.adain2.2.norm.bias", + "generator.resblocks.5.adain1.0.norm.weight", + "generator.resblocks.5.adain1.0.norm.bias", + "generator.resblocks.5.adain1.1.norm.weight", + "generator.resblocks.5.adain1.1.norm.bias", + "generator.resblocks.5.adain1.2.norm.weight", + "generator.resblocks.5.adain1.2.norm.bias", + "generator.resblocks.5.adain2.0.norm.weight", + "generator.resblocks.5.adain2.0.norm.bias", + "generator.resblocks.5.adain2.1.norm.weight", + "generator.resblocks.5.adain2.1.norm.bias", + "generator.resblocks.5.adain2.2.norm.weight", + "generator.resblocks.5.adain2.2.norm.bias" + ] + }, + { + "component": "text_encoder", + "identity_affine_keys": [] + } + ], + "parameters": 81810022, + "voice_shape": [ + 510, + 1, + 256 + ], + "gate_passed": true, + "weighted_rtf": 0.3390175984137203, + "production_preservation": { + "files_equal": true, + "cpu_tts_pids_equal": true, + "deck_start_equal": true + } +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/score.py b/docs/experiments/kikiri-anna-training-2026-10-27/score.py new file mode 100644 index 0000000..5240a88 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/score.py @@ -0,0 +1,36 @@ +"""Verify actual synthetic speech with existing native local CPU ASR.""" +from pathlib import Path +import json +import re +import subprocess +import time +from support import ROOT,write + +BASE=Path('/opt/athena-deck-dev/runtime/state/parakeet-runtime/v0.6.1') +CLI=BASE/'runtime/parakeet-v0.6.1-bin-linux-cpu-x64/parakeet-cli' + +def edits(a,b): + prev=list(range(len(b)+1)) + for i,x in enumerate(a,1): + row=[i] + for j,y in enumerate(b,1):row.append(min(row[-1]+1,prev[j]+1,prev[j-1]+(x!=y))) + prev=row + return prev[-1] + +rows=[] +for name in ['quality']: + source=ROOT/(name+'.json') + if not source.exists():continue + data=json.loads(source.read_text()) + assert data['phase'] in ['complete','speed_rejected'],'Do not score a failed/incomplete run' + for run in data['runs']: + started=time.monotonic() + proc=subprocess.run([str(CLI),'transcribe','--model',str(BASE/'redux-packed.gguf'), + '--input',str(ROOT/'outputs'/run['file']),'--lang','de','--threads','2','--json'], + capture_output=True,text=True,timeout=90) + row=dict(file=run['file'],case=run['case'],voice='Anna pilot',exit_code=proc.returncode,seconds=time.monotonic()-started) + if proc.returncode==0: + actual=json.loads(proc.stdout)['text'];a=re.findall(r'\w+',run['text'].casefold());b=re.findall(r'\w+',actual.casefold()) + row.update(expected=run['text'],recognized=actual,reference_words=len(a),word_edits=edits(a,b),exact_word_match=a==b) + else:row['error']=proc.stderr[-1000:] + rows.append(row);write(ROOT/'transcriptions.json',rows);print(json.dumps(row,ensure_ascii=False),flush=True) diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/speed.json b/docs/experiments/kikiri-anna-training-2026-10-27/speed.json new file mode 100644 index 0000000..d40992a --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/speed.json @@ -0,0 +1,271 @@ +{ + "phase": "complete", + "runs": [ + { + "file": "kikiri-anna-speed-story-1.wav", + "text": "Wenn du magst, erzähle ich dir eine kurze Geschichte. Anna öffnete das Fenster und hörte drei Vögel singen. Auf dem Tisch lagen sieben Bücher und eine rote Tasse. Zum Schluss sagte sie: Das hat wunderbar funktioniert.", + "normalized_text": "Wenn du magst, erzähle ich dir eine kurze Geschichte. Anna öffnete das Fenster und hörte drei Vögel singen. Auf dem Tisch lagen sieben Bücher und eine rote Tasse. Zum Schluss sagte sie: Das hat wunderbar funktioniert.", + "generation_seconds": 5.314632440000423, + "duration_seconds": 16.45, + "rtf": 0.3230779598784452, + "realtime_multiple": 3.095228162194165, + "first_complete_chunk_seconds": 5.31453562900424, + "chunks": 1, + "phonemes": [ + "vˌɛn duː mˈɑːkst, ɛɾʦˈɛːlə ɪç diːɾ ˌInə kˈʊɐʦə ɡəʃˈɪçtə. ˈanɑː ˈœfnətə das fˈɛnstɜ ʊnt hˈœɾtə dɾˈI vˈøːɡəl zˈɪŋən. Wf deːm tˈɪʃ lˈɑːɡən zˈiːbən bˈyːçɜ ʊnt ˌInə rˈoːtə tˈasə. ʦʊm ʃlˈʊs zˈɑːɡtə ziː: das hat vˈʊndɜbˌɑːɾ fʊŋkʦjˌoːnˈiːɾt." + ], + "dropped_phonemes": [], + "peak": 0.5309355854988098, + "clipped_fraction": 0.0, + "peak_rss_kib": 1242108, + "sha256": "8aa348e69e5de63a62989fbc6b0755b9dcaf1bbe7ccd47db6d7429d44cd4e6e1", + "case": "story", + "repetition": 1 + }, + { + "file": "kikiri-anna-speed-story-2.wav", + "text": "Wenn du magst, erzähle ich dir eine kurze Geschichte. Anna öffnete das Fenster und hörte drei Vögel singen. Auf dem Tisch lagen sieben Bücher und eine rote Tasse. Zum Schluss sagte sie: Das hat wunderbar funktioniert.", + "normalized_text": "Wenn du magst, erzähle ich dir eine kurze Geschichte. Anna öffnete das Fenster und hörte drei Vögel singen. Auf dem Tisch lagen sieben Bücher und eine rote Tasse. Zum Schluss sagte sie: Das hat wunderbar funktioniert.", + "generation_seconds": 4.723730679004802, + "duration_seconds": 16.45, + "rtf": 0.2871568801826628, + "realtime_multiple": 3.482416995768627, + "first_complete_chunk_seconds": 4.7236406699958025, + "chunks": 1, + "phonemes": [ + "vˌɛn duː mˈɑːkst, ɛɾʦˈɛːlə ɪç diːɾ ˌInə kˈʊɐʦə ɡəʃˈɪçtə. ˈanɑː ˈœfnətə das fˈɛnstɜ ʊnt hˈœɾtə dɾˈI vˈøːɡəl zˈɪŋən. Wf deːm tˈɪʃ lˈɑːɡən zˈiːbən bˈyːçɜ ʊnt ˌInə rˈoːtə tˈasə. ʦʊm ʃlˈʊs zˈɑːɡtə ziː: das hat vˈʊndɜbˌɑːɾ fʊŋkʦjˌoːnˈiːɾt." + ], + "dropped_phonemes": [], + "peak": 0.5309355854988098, + "clipped_fraction": 0.0, + "peak_rss_kib": 1295072, + "sha256": "8aa348e69e5de63a62989fbc6b0755b9dcaf1bbe7ccd47db6d7429d44cd4e6e1", + "case": "story", + "repetition": 2 + } + ], + "protocol": { + "device": "cpu", + "voice": "Anna pilot", + "cpu_threads": 4, + "interop_threads": 1, + "affinity": [ + 2, + 3, + 4, + 5, + 8, + 9, + 10, + 11 + ], + "precision": "fp32", + "seed": 42, + "speed": 1, + "gate_maximum_rtf": 0.5, + "german_frontend": "Kikiri lockfile Misaki DEG2P", + "compatibility_map": { + "ʏ": "y" + }, + "cpu_quota_percent": 400, + "memory_max_gib": 3, + "concurrent_llm_load_added": false + }, + "torch": "2.6.0+cpu", + "model_load_seconds": 0.7994754539977293, + "strict_components": [ + { + "component": "bert", + "identity_affine_keys": [] + }, + { + "component": "bert_encoder", + "identity_affine_keys": [] + }, + { + "component": "predictor", + "identity_affine_keys": [ + "F0.0.norm1.norm.weight", + "F0.0.norm1.norm.bias", + "F0.0.norm2.norm.weight", + "F0.0.norm2.norm.bias", + "F0.1.norm1.norm.weight", + "F0.1.norm1.norm.bias", + "F0.1.norm2.norm.weight", + "F0.1.norm2.norm.bias", + "F0.2.norm1.norm.weight", + "F0.2.norm1.norm.bias", + "F0.2.norm2.norm.weight", + "F0.2.norm2.norm.bias", + "N.0.norm1.norm.weight", + "N.0.norm1.norm.bias", + "N.0.norm2.norm.weight", + "N.0.norm2.norm.bias", + "N.1.norm1.norm.weight", + "N.1.norm1.norm.bias", + "N.1.norm2.norm.weight", + "N.1.norm2.norm.bias", + "N.2.norm1.norm.weight", + "N.2.norm1.norm.bias", + "N.2.norm2.norm.weight", + "N.2.norm2.norm.bias" + ] + }, + { + "component": "decoder", + "identity_affine_keys": [ + "encode.norm1.norm.weight", + "encode.norm1.norm.bias", + "encode.norm2.norm.weight", + "encode.norm2.norm.bias", + "decode.0.norm1.norm.weight", + "decode.0.norm1.norm.bias", + "decode.0.norm2.norm.weight", + "decode.0.norm2.norm.bias", + "decode.1.norm1.norm.weight", + "decode.1.norm1.norm.bias", + "decode.1.norm2.norm.weight", + "decode.1.norm2.norm.bias", + "decode.2.norm1.norm.weight", + "decode.2.norm1.norm.bias", + "decode.2.norm2.norm.weight", + "decode.2.norm2.norm.bias", + "decode.3.norm1.norm.weight", + "decode.3.norm1.norm.bias", + "decode.3.norm2.norm.weight", + "decode.3.norm2.norm.bias", + "generator.noise_res.0.adain1.0.norm.weight", + "generator.noise_res.0.adain1.0.norm.bias", + "generator.noise_res.0.adain1.1.norm.weight", + "generator.noise_res.0.adain1.1.norm.bias", + "generator.noise_res.0.adain1.2.norm.weight", + "generator.noise_res.0.adain1.2.norm.bias", + "generator.noise_res.0.adain2.0.norm.weight", + "generator.noise_res.0.adain2.0.norm.bias", + "generator.noise_res.0.adain2.1.norm.weight", + "generator.noise_res.0.adain2.1.norm.bias", + "generator.noise_res.0.adain2.2.norm.weight", + "generator.noise_res.0.adain2.2.norm.bias", + "generator.noise_res.1.adain1.0.norm.weight", + "generator.noise_res.1.adain1.0.norm.bias", + "generator.noise_res.1.adain1.1.norm.weight", + "generator.noise_res.1.adain1.1.norm.bias", + "generator.noise_res.1.adain1.2.norm.weight", + "generator.noise_res.1.adain1.2.norm.bias", + "generator.noise_res.1.adain2.0.norm.weight", + "generator.noise_res.1.adain2.0.norm.bias", + "generator.noise_res.1.adain2.1.norm.weight", + "generator.noise_res.1.adain2.1.norm.bias", + "generator.noise_res.1.adain2.2.norm.weight", + "generator.noise_res.1.adain2.2.norm.bias", + "generator.resblocks.0.adain1.0.norm.weight", + "generator.resblocks.0.adain1.0.norm.bias", + "generator.resblocks.0.adain1.1.norm.weight", + "generator.resblocks.0.adain1.1.norm.bias", + "generator.resblocks.0.adain1.2.norm.weight", + "generator.resblocks.0.adain1.2.norm.bias", + "generator.resblocks.0.adain2.0.norm.weight", + "generator.resblocks.0.adain2.0.norm.bias", + "generator.resblocks.0.adain2.1.norm.weight", + "generator.resblocks.0.adain2.1.norm.bias", + "generator.resblocks.0.adain2.2.norm.weight", + "generator.resblocks.0.adain2.2.norm.bias", + "generator.resblocks.1.adain1.0.norm.weight", + "generator.resblocks.1.adain1.0.norm.bias", + "generator.resblocks.1.adain1.1.norm.weight", + "generator.resblocks.1.adain1.1.norm.bias", + "generator.resblocks.1.adain1.2.norm.weight", + "generator.resblocks.1.adain1.2.norm.bias", + "generator.resblocks.1.adain2.0.norm.weight", + "generator.resblocks.1.adain2.0.norm.bias", + "generator.resblocks.1.adain2.1.norm.weight", + "generator.resblocks.1.adain2.1.norm.bias", + "generator.resblocks.1.adain2.2.norm.weight", + "generator.resblocks.1.adain2.2.norm.bias", + "generator.resblocks.2.adain1.0.norm.weight", + "generator.resblocks.2.adain1.0.norm.bias", + "generator.resblocks.2.adain1.1.norm.weight", + "generator.resblocks.2.adain1.1.norm.bias", + "generator.resblocks.2.adain1.2.norm.weight", + "generator.resblocks.2.adain1.2.norm.bias", + "generator.resblocks.2.adain2.0.norm.weight", + "generator.resblocks.2.adain2.0.norm.bias", + "generator.resblocks.2.adain2.1.norm.weight", + "generator.resblocks.2.adain2.1.norm.bias", + "generator.resblocks.2.adain2.2.norm.weight", + "generator.resblocks.2.adain2.2.norm.bias", + "generator.resblocks.3.adain1.0.norm.weight", + "generator.resblocks.3.adain1.0.norm.bias", + "generator.resblocks.3.adain1.1.norm.weight", + "generator.resblocks.3.adain1.1.norm.bias", + "generator.resblocks.3.adain1.2.norm.weight", + "generator.resblocks.3.adain1.2.norm.bias", + "generator.resblocks.3.adain2.0.norm.weight", + "generator.resblocks.3.adain2.0.norm.bias", + "generator.resblocks.3.adain2.1.norm.weight", + "generator.resblocks.3.adain2.1.norm.bias", + "generator.resblocks.3.adain2.2.norm.weight", + "generator.resblocks.3.adain2.2.norm.bias", + "generator.resblocks.4.adain1.0.norm.weight", + "generator.resblocks.4.adain1.0.norm.bias", + "generator.resblocks.4.adain1.1.norm.weight", + "generator.resblocks.4.adain1.1.norm.bias", + "generator.resblocks.4.adain1.2.norm.weight", + "generator.resblocks.4.adain1.2.norm.bias", + "generator.resblocks.4.adain2.0.norm.weight", + "generator.resblocks.4.adain2.0.norm.bias", + "generator.resblocks.4.adain2.1.norm.weight", + "generator.resblocks.4.adain2.1.norm.bias", + "generator.resblocks.4.adain2.2.norm.weight", + "generator.resblocks.4.adain2.2.norm.bias", + "generator.resblocks.5.adain1.0.norm.weight", + "generator.resblocks.5.adain1.0.norm.bias", + "generator.resblocks.5.adain1.1.norm.weight", + "generator.resblocks.5.adain1.1.norm.bias", + "generator.resblocks.5.adain1.2.norm.weight", + "generator.resblocks.5.adain1.2.norm.bias", + "generator.resblocks.5.adain2.0.norm.weight", + "generator.resblocks.5.adain2.0.norm.bias", + "generator.resblocks.5.adain2.1.norm.weight", + "generator.resblocks.5.adain2.1.norm.bias", + "generator.resblocks.5.adain2.2.norm.weight", + "generator.resblocks.5.adain2.2.norm.bias" + ] + }, + { + "component": "text_encoder", + "identity_affine_keys": [] + } + ], + "parameters": 81810022, + "voice_shape": [ + 510, + 1, + 256 + ], + "warmup": { + "file": null, + "text": "Die Sprachausgabe ist bereit.", + "normalized_text": "Die Sprachausgabe ist bereit.", + "generation_seconds": 0.7640361550002126, + "duration_seconds": 2.8, + "rtf": 0.2728700553572188, + "realtime_multiple": 3.6647480380024957, + "first_complete_chunk_seconds": 0.7639573180058505, + "chunks": 1, + "phonemes": [ + "diː ʃpɾˈɑːxWsɡˌɑːbə ɪst bərˈIt." + ], + "dropped_phonemes": [], + "peak": 0.5145857334136963, + "clipped_fraction": 0.0, + "peak_rss_kib": 1041152 + }, + "gate_passed": true, + "weighted_rtf": 0.305117420030554, + "production_preservation": { + "files_equal": true, + "cpu_tts_pids_equal": true, + "deck_start_equal": true + } +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/support.py b/docs/experiments/kikiri-anna-training-2026-10-27/support.py new file mode 100644 index 0000000..d2e1ffc --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/support.py @@ -0,0 +1,37 @@ +"""Small stdlib-only helpers; no production settings or credentials are read out.""" +from pathlib import Path +import hashlib +import json +import subprocess + +ROOT=Path('/data/athena-kikiri-anna-20261027') +REFS=Path('/data/athena-articulino-references-20261027/references') +STATE=Path('/opt/athena-deck-dev/runtime/state') +FILES=[STATE/n for n in ('profiles.json','endpoint.json','audio-policy.json','cpu-partition.json')] +FILES += [STATE/'speech-voices/Anna/reference.wav',Path('/opt/athena-deck-dev/source/qwen_native_worker.py')] +CASES=[dict(id='story',text='Wenn du magst, erzähle ich dir eine kurze Geschichte. Anna öffnete das Fenster und hörte drei Vögel singen. Auf dem Tisch lagen sieben Bücher und eine rote Tasse. Zum Schluss sagte sie: Das hat wunderbar funktioniert.'), + dict(id='technical',text='Home Assistant läuft in Docker auf Unraid. Die SSD hat 47 Grad Celsius. Das Logfile enthält keinen Fehler. Die Datei ist 512 MiB groß und die Verbindung überträgt 100 Mbit pro Sekunde. Um 18:30 CEST startet der nächste Scan.')] + +def write(path,data): + tmp=path.with_suffix('.tmp');tmp.write_text(json.dumps(data,indent=2,ensure_ascii=False));tmp.replace(path) + +def available(): + return next(int(s.split()[1])*1024 for s in Path('/proc/meminfo').read_text().splitlines() if s.startswith('MemAvailable:')) + +def snapshot(): + pids=dict(strata=[],articulino=[],qwen_tts=[]) + for p in Path('/proc').iterdir(): + if not p.name.isdigit():continue + try:args=(p/'cmdline').read_bytes().split(b'\0') + except OSError:continue + if args and args[0].endswith(b'/engine/strata'):pids['strata'].append(int(p.name)) + for key,name in [('articulino','articulino_worker.py'),('qwen_tts','qwen_native_worker.py')]: + if any(a.endswith(('/'+name).encode()) for a in args):pids[key].append(int(p.name)) + return dict(hashes={str(p):hashlib.file_digest(p.open('rb'),'sha256').hexdigest() for p in FILES},pids=pids, + deck_started=subprocess.check_output(['docker','inspect','--format','{{.State.StartedAt}}','athena-deck-dev'],text=True).strip()) + +def preservation(): + before=json.loads((ROOT/'production-before.json').read_text());after=snapshot() + write(ROOT/'production-after.json',after) + return dict(files_equal=before['hashes']==after['hashes'],cpu_tts_pids_equal=before['pids']['articulino']==after['pids']['articulino'] and before['pids']['qwen_tts']==after['pids']['qwen_tts'], + deck_start_equal=before['deck_started']==after['deck_started']) diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/train.py b/docs/experiments/kikiri-anna-training-2026-10-27/train.py new file mode 100644 index 0000000..a96a910 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/train.py @@ -0,0 +1,102 @@ +"""Bounded official two-stage fine-tune; own process/checkpoints only.""" +from pathlib import Path +import os,sys,json,time,random,hashlib +ROOT=Path('/data/athena-kikiri-anna-20261027') +PUBLIC=Path('/data/athena-kikiri-victoria-cpu-20261027') +os.environ.update(HF_HOME=str(ROOT/'cache/huggingface'),HF_HUB_OFFLINE='1', + HF_HUB_DISABLE_TELEMETRY='1',HF_HUB_DISABLE_IMPLICIT_TOKEN='1',TOKENIZERS_PARALLELISM='false', + MPLCONFIGDIR=str(ROOT/'cache/matplotlib'),XDG_CACHE_HOME=str(ROOT/'cache'),OMP_NUM_THREADS='4',OPENBLAS_NUM_THREADS='1', + PYTHONUNBUFFERED='1',ACCELERATE_MIXED_PRECISION='no') +os.umask(0o077) +os.chdir(ROOT/'StyleTTS2');sys.path.insert(0,str(ROOT/'StyleTTS2')) +import yaml,numpy as np,torch +torch.set_num_threads(4);torch.set_num_interop_threads(1) +phase=sys.argv[1] +config=yaml.safe_load((PUBLIC/'source/configs/config_german_ft.yml').read_text()) +config.pop('training',None) +config.update(batch_size=2,epochs_1st=10,epochs_2nd=12,save_freq=11,log_interval=5,max_len=200, + log_dir=str(ROOT/'run'),pretrained_model=str(ROOT/'base/stage1_ep4_raw.pth'),first_stage_path='first_stage.pth', + load_only_params=True,second_stage_load_pretrained=False) +config['data_params'].update(train_data=str(ROOT/'data/train.txt'),val_data=str(ROOT/'data/val.txt'), + root_path=str(ROOT/'data/audio'),OOD_data=str(ROOT/'data/OOD_texts.txt'),num_workers=2) +config['model_params']['slm']['model']=str(ROOT/'wavlm') +config['model_params']['diffusion']['dist']['estimate_sigma_data']=False +config['optimizer_params'].update(lr=5e-5,ft_lr=5e-5,bert_lr=5e-6) +if phase=='second': + # Upstream requires at least two examples in SLMAdversarialLoss, while + # batch_percentage=.5 selects only one from batch two and always skips it. + # Use both examples with shorter crops to fit 16 GB; keep actual GAN/SLM. + config['slmadv_params'].update(batch_percentage=1.0,max_len=160) + config['max_len']=160 +for key,name in [('F0_path','JDC/bst.t7'),('ASR_path','ASR/epoch_00080.pth'),('ASR_config','ASR/config.yml'),('PLBERT_dir','PLBERT')]: + config[key]=str(ROOT/'StyleTTS2/Utils'/name) +(ROOT/'run').mkdir(exist_ok=True) +cfg=ROOT/('config-'+phase+'.yml');cfg.write_text(yaml.safe_dump(config)) +if phase=='preflight': + import models,monotonic_align,kokoro_symbols + base=torch.load(ROOT/'base/stage1_ep4_raw.pth',map_location='cpu',weights_only=True) + summary={k:dict(tensors=len(v),parameters=sum(x.numel() for x in v.values() if torch.is_tensor(x))) for k,v in base['net'].items()} + (ROOT/'base-components.json').write_text(json.dumps(summary,indent=2)) + print(json.dumps(dict(torch=torch.__version__,cuda_build=torch.version.cuda,components=summary)),flush=True) + sys.exit(0) +assert torch.cuda.is_available() and '5080' in torch.cuda.get_device_name(0) +assert torch.cuda.device_count()==1 +import models,optimizers,kokoro_tb_utils +original_load=models.load_checkpoint +checks=[] +def checked_load(model,optimizer,path,load_only_params=True,ignore_modules=[]): + # Inspect all loaded state keys; the upstream broad strict=False is not + # accepted as proof that pretrained linguistic/acoustic tensors were used. + loader=getattr(torch,'_original_load',torch.load) + state=loader(path,map_location='cpu',weights_only=True)['net'] + # Kokoro never invokes the diffusion sampler (lambda_diff=0, diff_epoch=999). + # The multi-speaker base contains conditioning tensors absent from the + # single-speaker diffusion stub; do not load this explicitly unused module. + ignore_modules=list(set(ignore_modules)|{'diffusion'}) + for key in model: + if key in ignore_modules:continue + if key not in state: + assert key in ('diffusion','wd','mpd','msd'),key + continue + check=model[key].load_state_dict(state[key],strict=False) + assert not check.unexpected_keys,(key,check.unexpected_keys) + assert not check.missing_keys,(key,check.missing_keys) + checks.append(dict(component=key,tensors=len(state[key]),path=Path(path).name)) + del state + (ROOT/('load-check-'+phase+'.json')).write_text(json.dumps(checks,indent=2)) + return original_load(model,optimizer,path,load_only_params,ignore_modules) +models.load_checkpoint=checked_load +# Retain weight-only pilot checkpoints; this is not a resumable long training +# run. Avoid repeatedly saving multi-GB Adam moments on the small test disk. +original_save=torch.save +def save_weights(obj,f,*args,**kw): + if isinstance(obj,dict) and 'net' in obj and str(f).endswith('.pth'): + obj={k:v for k,v in obj.items() if k!='optimizer'} + return original_save(obj,f,*args,**kw) +torch.save=save_weights +steps={};original_step=optimizers.MultiOptimizer.step +def step(self,key=None,scaler=None): + label=key or 'all';steps[label]=steps.get(label,0)+1 + return original_step(self,key,scaler) +optimizers.MultiOptimizer.step=step +# Diagnostic previews must use only training audio, not held-out samples. +original_extract=kokoro_tb_utils.extract_voicepack +def extract(model,root_path,device,n_samples=200): + return original_extract(model,str(ROOT/'data/training-audio'),device,n_samples=min(n_samples,16)) +kokoro_tb_utils.extract_voicepack=extract +# Final CPU evaluation is separate; avoid downloading a G2P in the GPU unit. +kokoro_tb_utils.prepare_test_tokens=lambda cleaner: [] +random.seed(20261027);np.random.seed(20261027);torch.manual_seed(20261027) +torch.cuda.reset_peak_memory_stats();start=time.monotonic() +result=dict(phase=phase,device=torch.cuda.get_device_name(0),seed=20261027) +try: + module=__import__('train_first' if phase=='first' else 'train_second') + torch.autograd.set_detect_anomaly(False) + module.main.main(args=['--config_path',str(cfg)],standalone_mode=False) + result['success']=True +finally: + result.update(wall_seconds=time.monotonic()-start,optimizer_step_calls=steps, + peak_allocated_bytes=torch.cuda.max_memory_allocated(),peak_reserved_bytes=torch.cuda.max_memory_reserved(), + strict_loaded_components=checks) + (ROOT/('training-'+phase+'.json')).write_text(json.dumps(result,indent=2)) + print(json.dumps(result),flush=True) diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/training-first.json b/docs/experiments/kikiri-anna-training-2026-10-27/training-first.json new file mode 100644 index 0000000..a60b78c --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/training-first.json @@ -0,0 +1,80 @@ +{ + "phase": "first", + "device": "NVIDIA GeForce RTX 5080", + "seed": 20261027, + "success": true, + "wall_seconds": 214.42373183601012, + "optimizer_step_calls": { + "msd": 310, + "mpd": 310, + "text_encoder": 310, + "style_encoder": 310, + "decoder": 310, + "text_aligner": 310, + "pitch_extractor": 310 + }, + "peak_allocated_bytes": 10081972736, + "peak_reserved_bytes": 10993270784, + "strict_loaded_components": [ + { + "component": "bert", + "tensors": 25, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "bert_encoder", + "tensors": 2, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "predictor", + "tensors": 122, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "decoder", + "tensors": 375, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "text_encoder", + "tensors": 24, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "predictor_encoder", + "tensors": 67, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "style_encoder", + "tensors": 67, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "text_aligner", + "tensors": 143, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "pitch_extractor", + "tensors": 77, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "mpd", + "tensors": 90, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "msd", + "tensors": 54, + "path": "stage1_ep4_raw.pth" + }, + { + "component": "wd", + "tensors": 15, + "path": "stage1_ep4_raw.pth" + } + ] +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/training-requirements-resolved.txt b/docs/experiments/kikiri-anna-training-2026-10-27/training-requirements-resolved.txt new file mode 100644 index 0000000..a5ca025 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/training-requirements-resolved.txt @@ -0,0 +1,89 @@ +absl-py==2.5.1 +accelerate==1.3.0 +audioread==3.1.0 +certifi==2026.10.23 +cffi==2.1.1 +charset-normalizer==3.5.2 +click==8.1.8 +cloudpickle==3.1.2 +contourpy==1.3.3 +cycler==0.12.1 +cython==3.0.12 +decorator==5.3.1 +einops==0.8.1 +einops-exts==0.0.4 +filelock==3.32.3 +fonttools==4.68.0 +fsspec==2026.7.0 +grpcio==1.85.0 +hf-xet==1.7.0 +huggingface-hub==0.36.2 +idna==3.20 +jinja2==3.1.6 +joblib==1.6.0 +kiwisolver==1.5.1 +lazy-loader==0.6 +librosa==0.10.2.post1 +llvmlite==0.50.0 +markdown==3.11.2 +markupsafe==3.0.3 +matplotlib==3.10.0 +monotonic-align @ file:///data/athena-kikiri-anna-20261027/monotonic_align +mpmath==1.3.0 +msgpack==1.2.4 +munch==4.0.0 +narwhals==2.28.0 +networkx==3.6.1 +nltk==3.9.1 +numba==0.68.0 +numpy==1.26.4 +nvidia-cublas-cu12==12.8.3.14 +nvidia-cuda-cupti-cu12==12.8.57 +nvidia-cuda-nvrtc-cu12==12.8.61 +nvidia-cuda-runtime-cu12==12.8.57 +nvidia-cudnn-cu12==9.7.1.26 +nvidia-cufft-cu12==11.3.3.41 +nvidia-cufile-cu12==1.13.0.11 +nvidia-curand-cu12==10.3.9.55 +nvidia-cusolver-cu12==11.7.2.55 +nvidia-cusparse-cu12==12.5.7.53 +nvidia-cusparselt-cu12==0.6.3 +nvidia-nccl-cu12==2.26.2 +nvidia-nvjitlink-cu12==12.8.61 +nvidia-nvtx-cu12==12.8.55 +packaging==26.3 +pandas==2.2.3 +pillow==13.0.0 +platformdirs==4.13.6 +pooch==1.9.0 +protobuf==7.36.2 +psutil==7.2.2 +pycparser==3.12 +pyparsing==3.3.3 +python-dateutil==3.0.0 +pytz==2026.5 +pyyaml==6.0.2 +regex==2026.9.29 +requests==2.34.2 +safetensors==0.8.0 +scikit-learn==1.9.1 +scipy==1.17.1 +setuptools==75.8.0 +six==1.17.0 +soundfile==0.13.1 +soxr==1.1.0 +sympy==1.14.0 +tensorboard==2.19.0 +tensorboard-data-server==0.7.2 +threadpoolctl==3.7.0 +tokenizers==0.21.4 +torch==2.7.1+cu128 +torchaudio==2.7.1+cu128 +tqdm==4.70.1 +transformers==4.48.3 +triton==3.3.1 +typing-extensions==4.16.0 +tzdata==2026.5 +urllib3==2.8.0 +werkzeug==3.1.9 +wheel==0.45.1 diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/training-second.json b/docs/experiments/kikiri-anna-training-2026-10-27/training-second.json new file mode 100644 index 0000000..e6f0d72 --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/training-second.json @@ -0,0 +1,63 @@ +{ + "phase": "second", + "device": "NVIDIA GeForce RTX 5080", + "seed": 20261027, + "success": true, + "wall_seconds": 273.2206063670019, + "optimizer_step_calls": { + "bert_encoder": 651, + "bert": 651, + "predictor": 651, + "predictor_encoder": 372, + "msd": 279, + "mpd": 279, + "style_encoder": 279, + "decoder": 279, + "diffusion": 279, + "wd": 27 + }, + "peak_allocated_bytes": 13029578240, + "peak_reserved_bytes": 13927186432, + "strict_loaded_components": [ + { + "component": "bert", + "tensors": 25, + "path": "first_stage.pth" + }, + { + "component": "bert_encoder", + "tensors": 2, + "path": "first_stage.pth" + }, + { + "component": "predictor", + "tensors": 122, + "path": "first_stage.pth" + }, + { + "component": "decoder", + "tensors": 375, + "path": "first_stage.pth" + }, + { + "component": "text_encoder", + "tensors": 24, + "path": "first_stage.pth" + }, + { + "component": "style_encoder", + "tensors": 67, + "path": "first_stage.pth" + }, + { + "component": "text_aligner", + "tensors": 143, + "path": "first_stage.pth" + }, + { + "component": "pitch_extractor", + "tensors": 77, + "path": "first_stage.pth" + } + ] +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/transcriptions.json b/docs/experiments/kikiri-anna-training-2026-10-27/transcriptions.json new file mode 100644 index 0000000..131b3dc --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/transcriptions.json @@ -0,0 +1,14 @@ +[ + { + "file": "kikiri-anna-quality-technical-1.wav", + "case": "technical", + "voice": "Anna pilot", + "exit_code": 0, + "seconds": 1.539698420005152, + "expected": "Home Assistant läuft in Docker auf Unraid. Die SSD hat 47 Grad Celsius. Das Logfile enthält keinen Fehler. Die Datei ist 512 MiB groß und die Verbindung überträgt 100 Mbit pro Sekunde. Um 18:30 CEST startet der nächste Scan.", + "recognized": "Homa Assistant läuft in Docker auf Unreid. Die SSD hat 47 Grad Celsius. Das Lockfiele enthält keinen Fehler. Die Datei ist 512 MB groß und die Verbindung überträgt 100 Mbit pro Sekunde. Um 18.30 Uhr Kest startet der nächste Scarn.", + "reference_words": 40, + "word_edits": 7, + "exact_word_match": false + } +] \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-training-2026-10-27/verify.py b/docs/experiments/kikiri-anna-training-2026-10-27/verify.py new file mode 100644 index 0000000..92cebaa --- /dev/null +++ b/docs/experiments/kikiri-anna-training-2026-10-27/verify.py @@ -0,0 +1,21 @@ +"""Compare only relevant state hashes/PIDs and public worker health metadata.""" +from pathlib import Path +import json,subprocess,urllib.request +from support import ROOT,STATE,snapshot,write +before=json.loads((ROOT/'production-before.json').read_text());after=snapshot() +worker=json.loads((STATE/'strata-worker/worker.json').read_text()) +result=dict(files_equal=before['hashes']==after['hashes'], + cpu_tts_pids_equal=before['pids']['articulino']==after['pids']['articulino'] and before['pids']['qwen_tts']==after['pids']['qwen_tts'], + deck_start_equal=before['deck_started']==after['deck_started'], + previous_profile=before['previous_profile'],current_profile=worker['model_name'],strata_running=bool(after['pids']['strata'])) +# A normal authenticated completion is separately required by control.py. +own=[] +for p in Path('/proc').iterdir(): + if not p.name.isdigit():continue + try:args=(p/'cmdline').read_bytes().split(b'\0') + except OSError:continue + if any(a.endswith(b'/train.py') for a in args) and str(ROOT).encode() in b' '.join(args):own.append(int(p.name)) +result['owned_trainers']=own +result['passed']=all(result[k] for k in ('files_equal','cpu_tts_pids_equal','deck_start_equal','strata_running')) and not own and result['current_profile']==result['previous_profile'] +write(ROOT/'final-verification.json',result);print(json.dumps(result),flush=True) +assert result['passed'] diff --git a/docs/experiments/tts-candidate-shortlist-2026-10-27.md b/docs/experiments/tts-candidate-shortlist-2026-10-27.md index f828857..c69c2b9 100644 --- a/docs/experiments/tts-candidate-shortlist-2026-10-27.md +++ b/docs/experiments/tts-candidate-shortlist-2026-10-27.md @@ -17,7 +17,8 @@ record the verdict and clean up its own test data when requested. | Sopro V2 Turbo, FP32 | **Serious candidate; retain — preferred listening sample: technical B** | About 2.42× realtime on Athena CPU, four threads. All three story samples matched all words in local STT. Raw technical text still has ASR discrepancies around Unraid, MiB, CEST and time wording. Michael hears technical B as the closest Anna approximation so far, better than Articulino but not perfect. Reference B is 05:25.14–05:33.00 of the supplied recording; fixed recipe and results: [Sopro experiment](sopro-cpu-2026-10-27/README.md). No activation/integration authorized; continue evaluating other models. | | Qwen3-TTS 0.6B Q4 / Q8 codec | Retained comparison reference | Same three clips/text gave about 15 s in 14.111–14.645 s. This passage was complete in STT; previous intermittent noise failures remain unresolved. This row makes no claim about which profile is currently published. | | Chatterbox Nano + German community LoRA, FP32 | **Stronger perceived Anna identity; accent and CPU reserve unresolved** | Explicit Athena trial: Anna B, four CPU threads, adapter merged in RAM, 16.98 s audio in 14.815 s (RTF 0.8725, 1.146× realtime), first synthesis. No warm repeat or quality matrix after missing the 2× gate. Michael hears Anna more clearly, with a slight Chinese-sounding accent. He confirms “rote Tasse” is correct: the raw STT “hohe Tasse” was an ASR error, not a confirmed TTS word error. No general claim about untested precision/runtime alternatives. No activation; Sopro technical B remains the reference. [Actual trial](chatterbox-nano-de-cpu-2026-10-27/README.md). | -| Kokoro/Kikiri German Victoria, FP32 | **CPU speed gate passed; listening verdict pending; Anna untested** | Explicit CPU-only test with the public Victoria voice: story 14.5 s in 4.24–4.78 s; technical text 19 s in 6.70 s (2.84× realtime). Local STT recovered numbers/time; technical term discrepancies remain, and the frontend pronounces CEST as a word. This is not an Anna-cloning sample or proof that Anna fine-tuning will work. No training, GPU test or activation. [Victoria trial](kikiri-victoria-cpu-2026-10-27/README.md). | +| Kokoro/Kikiri German Victoria, FP32 | **CPU speed gate passed; original Victoria listening verdict pending** | Explicit CPU-only test with the public Victoria voice: story 14.5 s in 4.24–4.78 s; technical text 19 s in 6.70 s (2.84× realtime). Local STT recovered numbers/time; technical term discrepancies remain, and the frontend pronounces CEST as a word. This is not an Anna-cloning sample or proof that Anna fine-tuning will work. That original Victoria trial did not train or activate a model. A separately authorized Anna pilot is now recorded below. [Victoria trial](kikiri-victoria-cpu-2026-10-27/README.md). | +| Kokoro/Kikiri Anna fine-tune, FP32 | **Trained pilot; CPU speed gate passed; human voice verdict pending** | Trained on 63 Anna segments with separate validation/held-out clips: ten acoustic + twelve prosody epochs, RTX 5080. Same technical text: 20.175 s in 6.840 s on four CPU threads (2.95× realtime). STT recovers the paragraph, with Home/Logfile/CEST and other technical deviations; no Anna-identity claim from STT. Active TTS unchanged, Qwen restored. Sopro technical B remains the listening reference until Michael judges this sample. [Anna pilot](kikiri-anna-training-2026-10-27/README.md). | | Audio8 TTS Preview 0.1B ONNX INT8 | **Rejected and deleted** | CPU speed fails; Michael also reports a Chinese-sounding accent. All isolated weights, venv, derived voices, pilot data and audio deleted remotely and locally: about 1.49 GiB on Athena plus 8.3 MiB local. Small records remain in `audio8-cpu-2026-10-27/`. Qwen and Articulino preserved. | | Pocket TTS German | Already tested, not a newly discovered alternative | Existing 17 October Anna CPU runs had RTF 0.453/0.462. Do not present it as untested or claim the newly advertised tiny English models support German. A different German checkpoint/recipe would need a specific reason to retest. | | MOSS-TTS-Nano / NeuTTS-Nano German Q8 | Rejected; test weights removed | Michael rejected pronunciation/naturalness. Do not silently reinstall or rank them as acceptable based on ASR. |