import sys, os, glob, importlib.util, torch, soundfile as sf from pathlib import Path from huggingface_hub import snapshot_download seed = int(sys.argv[1]) md = Path(snapshot_download("Reza2kn/Gooya-Bozorg-v1.5")) spec = importlib.util.spec_from_file_location("inf", md / "inference.py"); inf = importlib.util.module_from_spec(spec); spec.loader.exec_module(inf) torch.set_num_threads(os.cpu_count()) model = inf.load_model(md, "cpu") lines = [l.strip() for l in open("tts/lines.txt", encoding="utf-8") if l.strip()] out = Path(f"tts/out/s{seed}"); out.mkdir(parents=True, exist_ok=True) only = [int(x) for x in sys.argv[2].split(",")] if len(sys.argv) > 2 else None for i, t in enumerate(lines): if only is not None and i not in only: continue torch.manual_seed(seed * 100 + i) wav = model.generate(text=t, language_id=None, audio_prompt_path=str(md / "samples/canonical.wav"), exaggeration=0.5, cfg_weight=0.5) sf.write(out / f"{i:02d}.wav", wav.squeeze().cpu().numpy(), model.sr) print("done", seed, i, flush=True)