76 lines
2.0 KiB
Python
76 lines
2.0 KiB
Python
import os
|
|
import sys
|
|
|
|
# Force CPU inference for preview to prevent GPU VRAM collision with training
|
|
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
|
|
|
applio_dir = r"C:\GitHub\VocoLoom\Applio"
|
|
sys.path.insert(0, applio_dir)
|
|
os.chdir(applio_dir)
|
|
|
|
from core import run_tts_script
|
|
|
|
log_dir = os.path.join(applio_dir, "logs", "Juergen_Seiferth")
|
|
index_path = os.path.join(log_dir, "Juergen_Seiferth.index")
|
|
|
|
pth_candidates = [
|
|
f for f in os.listdir(log_dir)
|
|
if f.startswith("Juergen_Seiferth_") and f.endswith(".pth")
|
|
]
|
|
|
|
def get_epoch(fn):
|
|
try:
|
|
parts = fn.split("_")
|
|
for p in parts:
|
|
if p.endswith("e") and p[:-1].isdigit():
|
|
return int(p[:-1])
|
|
except Exception:
|
|
pass
|
|
return 0
|
|
|
|
pth_candidates.sort(key=get_epoch)
|
|
latest_checkpoint = pth_candidates[-1]
|
|
latest_pth = os.path.join(log_dir, latest_checkpoint)
|
|
print(f"Using checkpoint: {latest_checkpoint}")
|
|
print(f"Using index: {index_path} (exists: {os.path.exists(index_path)})")
|
|
|
|
text = (
|
|
"Pass mal auf! Was nicht ganz läuft so wie ich das will, das wird so gemacht, damit das läuft! "
|
|
"Fertig Ballett oder was?! Hauptsache angekommen, stimmt's?!"
|
|
)
|
|
|
|
output_tts = r"C:\GitHub\VocoLoom\tts_conrad.wav"
|
|
output_rvc = r"C:\GitHub\VocoLoom\juergen_conrad_index85_" + latest_checkpoint.replace(".pth", ".wav")
|
|
|
|
res = run_tts_script(
|
|
tts_file="",
|
|
tts_text=text,
|
|
tts_voice="de-DE-ConradNeural",
|
|
tts_rate=0,
|
|
pitch=-2,
|
|
index_rate=0.85,
|
|
volume_envelope=1.0,
|
|
protect=0.33,
|
|
f0_method="rmvpe",
|
|
output_tts_path=output_tts,
|
|
output_rvc_path=output_rvc,
|
|
pth_path=latest_pth,
|
|
index_path=index_path if os.path.exists(index_path) else "",
|
|
f0_autotune=False,
|
|
f0_autotune_strength=1.0,
|
|
proposed_pitch=False,
|
|
proposed_pitch_threshold=155.0,
|
|
export_format="WAV",
|
|
embedder_model="contentvec",
|
|
embedder_model_custom=None,
|
|
sid=0,
|
|
formant_shifting=False,
|
|
formant_qfrency=1.0,
|
|
formant_timbre=1.0,
|
|
cleanup_mode="off",
|
|
cleanup_strength=12,
|
|
)
|
|
|
|
print(f"Generated: {output_rvc}")
|
|
print(f"Details: {res}")
|