Lucy-TTS/F5: Skripte + Batches versionieren, schwere Assets ignoriert

- pocket_server.py (Produktions-TTS mit Stimmen-Waechter), text_norm, Bench-/Diag-Skripte
- lucy-f5: f5_server/f5_test/bench_dml (DirectML-Experiment, Phase C/D offen)
- .gitignore: venvs/Modelle/Audio/Logs der beiden Ordner + box_recon/gemma_swap-Scratch

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-07-02 10:29:33 +02:00
parent aff0105700
commit 09a1c98514
49 changed files with 8231 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
"""Stabilität gegen Stimm-Kollaps: temp 0.9 mit/ohne noise_clamp. F0-Verteilung + Whisper + RTF.
Mehr Samples, um einen Kollaps (tiefe F0) zu provozieren und zu sehen, ob noise_clamp ihn dämpft."""
import os, time, numpy as np, librosa, soundfile as sf
from pocket_tts import TTSModel
from faster_whisper import WhisperModel
BASE = r"F:\Coding Stuff\mission-control-2\client\lucy-tts"
src,_ = librosa.load(os.path.join(BASE,"ref.mp3"), sr=24000, mono=True)
srt,_ = librosa.effects.trim(src, top_db=30); ref=os.path.join(BASE,"ref.wav")
sf.write(ref, srt[:int(18*24000)], 24000)
LEAD="Tja. "
TEXTS = ["Hallo Commander, ich höre dich.","Natürlich, das mache ich sofort für dich.",
"Die Hitze ist heute wirklich heftig.","Klar, ich kümmere mich gleich darum.",
"Guten Morgen, Commander, alles sauber.","Kein Problem, ich erledige das jetzt.",
"Das Backup lief ohne Fehler durch.","Verstanden, Commander, ich bleibe dran."]
w = WhisperModel("small", device="cpu", compute_type="int8")
def f0_of(a, sr):
f0,_,_ = librosa.pyin(a, fmin=80, fmax=400, sr=sr, frame_length=1024)
v=f0[~np.isnan(f0)]; return float(np.median(v)) if v.size else float("nan")
def run(temp, nc):
m = TTSModel.load_model(language="german_24l", lsd_decode_steps=6, temp=temp, noise_clamp=nc)
vs = m.get_state_for_audio_prompt(ref); sr=m.sample_rate
print(f"=== temp={temp} noise_clamp={nc} ===", flush=True)
f0s=[]; rtfs=[]
for i in range(12):
t=TEXTS[i%len(TEXTS)]
t0=time.time(); a=m.generate_audio(vs, LEAD+t, frames_after_eos=4); dt=time.time()-t0
a=a.numpy() if hasattr(a,"numpy") else np.asarray(a); a=np.asarray(a,dtype=np.float32).reshape(-1)
f0=f0_of(a,sr); f0s.append(f0); rtfs.append(dt/max(a.size/sr,0.01))
flag=" <<< MÄNNLICH/Kollaps?" if (f0==f0 and f0<150) else ""
print(f" [{i:2}] F0={f0:6.1f}Hz{flag}", flush=True)
arr=np.array([x for x in f0s if x==x])
print(f" -> F0 median {np.median(arr):.0f} min {arr.min():.0f} max {arr.max():.0f} | RTF~{np.median(rtfs):.2f}", flush=True)
run(0.9, None)
run(0.9, 3.0)
print("NC_DONE")