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:
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os, time, glob, numpy as np, soundfile as sf, librosa
|
||||
from pocket_tts import TTSModel
|
||||
|
||||
BASE = r"F:\Coding Stuff\mission-control-2\client\lucy-tts"
|
||||
OUT = os.path.join(BASE, "out_tune"); os.makedirs(OUT, exist_ok=True)
|
||||
y, _ = librosa.load(os.path.join(BASE, "ref.mp3"), sr=24000, mono=True)
|
||||
yt, _ = librosa.effects.trim(y, top_db=30); ref = os.path.join(BASE, "ref.wav")
|
||||
sf.write(ref, yt[:int(18*24000)], 24000)
|
||||
|
||||
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.",
|
||||
}
|
||||
def light_trim(a, sr):
|
||||
a = np.asarray(a, dtype=np.float32).reshape(-1)
|
||||
yt, _ = librosa.effects.trim(a, top_db=30)
|
||||
return yt if yt.size else a
|
||||
|
||||
for lsd in [2, 4, 8]:
|
||||
t0 = time.time()
|
||||
m = TTSModel.load_model(language="german_24l", lsd_decode_steps=lsd)
|
||||
vs = m.get_state_for_audio_prompt(ref)
|
||||
print(f"== lsd={lsd} (load {time.time()-t0:.1f}s) ==", flush=True)
|
||||
for name, text in SENT.items():
|
||||
t0 = time.time(); audio = m.generate_audio(vs, text); dt = time.time()-t0
|
||||
a = audio.numpy() if hasattr(audio, "numpy") else np.asarray(audio)
|
||||
a = light_trim(a, m.sample_rate)
|
||||
secs = a.size / m.sample_rate
|
||||
sf.write(os.path.join(OUT, f"lsd{lsd}_{name}.wav"), a, m.sample_rate)
|
||||
print(f" [{name:6}] gen={dt:5.2f}s audio={secs:5.2f}s RTF={dt/max(secs,0.01):.2f}", flush=True)
|
||||
print("TUNE_DONE", flush=True)
|
||||
Reference in New Issue
Block a user