"""Exploratory: the original, 100 sentences, seed set 7000, with a voice prefix (clip 0, made by the model itself).""" import sys; from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) import numpy as np, torch, soundfile as sf, codec, reference as R, texts half = np.array([4, 3, 3, 3] * 8, np.float32); r, c = R.Reference(), codec.load() pre = torch.from_numpy(np.load(R.ROOT / "runs/clips/0.npz")["prefix"])[None]; out = R.ROOT / "runs" / "words-refvoice-7000"; out.mkdir(parents=True, exist_ok=True) for i, t in enumerate(texts.ALL): codes = r.generate(t, seed=7000 + i, max_frames=600, prefix=pre) with torch.no_grad(): a, _ = c.decode_audio(inputs=torch.from_numpy((codes.astype(np.float32) - half) / half).T[None], input_len=torch.tensor([len(codes)])) sf.write(out / f"{i:03d}.wav", a[0].numpy(), 22050); np.save(out / f"{i:03d}.npy", codes) print("done", flush=True)