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
+45
View File
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
import os, time, numpy as np, soundfile as sf, librosa, torch, torchaudio
def _ta_load(p,*a,**k):
x,sr=sf.read(p,dtype="float32"); return torch.from_numpy((x.T if x.ndim>1 else x[None,:]).copy()),sr
def _ta_save(p,t,sample_rate=24000,*a,**k):
sr=k.get("sample_rate",sample_rate); x=t.detach().cpu().numpy()
sf.write(p,(x.T if x.ndim>1 else x.reshape(-1)),int(sr))
torchaudio.load=_ta_load; torchaudio.save=_ta_save
def _wl(f,sr=16000):
y,_=librosa.load(f,sr=sr,mono=True); return y.astype(np.float32)
try:
import whisper.audio as _wa; _wa.load_audio=_wl
import whisper.transcribe as _wt; _wt.load_audio=_wl
except Exception as e: print("whisper-patch:", e, flush=True)
import outetts
BASE = r"F:\Coding Stuff\mission-control-2\client\lucy-tts"
ref = os.path.join(BASE, "ref.wav")
y,_ = librosa.load(os.path.join(BASE,"ref.mp3"), sr=24000, mono=True)
yt,_ = librosa.effects.trim(y, top_db=30)
sf.write(ref, yt[:int(14*24000)], 24000)
cfg = outetts.ModelConfig(
model_path=os.path.join(BASE,"models","OuteTTS-1.0-1B-Q8_0.gguf"),
tokenizer_path="OuteAI/Llama-OuteTTS-1.0-1B",
interface_version=outetts.InterfaceVersion.V3,
backend=outetts.Backend.LLAMACPP,
)
cfg.n_gpu_layers = 999
t0=time.time(); iface=outetts.Interface(config=cfg); print(f"[iface] {time.time()-t0:.1f}s", flush=True)
spk=iface.create_speaker(ref); print("[clone ok]", flush=True)
OUT=os.path.join(BASE,"out"); os.makedirs(OUT,exist_ok=True)
SENT={
"kurz":"Hallo Commander, ich höre dich.",
"mittel":"Guten Morgen, Commander. Das Backup ist sauber durchgelaufen und es gab keine Fehler.",
"lang":"Natürlich kümmere ich mich darum, Commander. Ich starte den Dienst neu, prüfe die Protokolle und melde mich, sobald alles wieder läuft.",
}
for name,text in SENT.items():
for run in ("cold","warm"):
t0=time.time(); out=iface.generate(config=outetts.GenerationConfig(text=text, speaker=spk)); dt=time.time()-t0
p=os.path.join(OUT,f"{name}.wav"); out.save(p)
x,sr=sf.read(p); secs=len(x)/sr
print(f"[{name:6} {run:4}] gen={dt:5.2f}s audio={secs:5.2f}s RTF={dt/max(secs,0.01):.2f}", flush=True)
print("PC_DONE", flush=True)