Test harness updated correctly

This commit is contained in:
arensc
2024-03-08 11:54:09 -05:00
parent d191a9eb3b
commit cfddda8e9d
2 changed files with 5 additions and 7 deletions
-4
View File
@@ -1,4 +0,0 @@
This is!
Hello world testing!
This is a slightly... longer test.
This is a longer test, of style TTS Two! This should be a lengthy sentence.
+5 -3
View File
@@ -60,14 +60,13 @@ class TestHarness:
model = StyleTTS2(check_point)
char_name_ls = TestHarness.get_characters()
count = 0
for char_name in char_name_ls.keys():
char_sample = char_name_ls[char_name]
for sample in char_sample:
s_ref = Path(sample.full_path)
s_ref = model.compute_style(s_ref)
for i,text in enumerate(self.test_text):
# we shouldn't set the embedding scale high on some text / input audio lengths it will break the audio
mono_wav = model.STinference(text=text,
@@ -75,7 +74,10 @@ class TestHarness:
ref_s=s_ref,
diffusion_steps=10,alpha=0.45, beta=0.6, embedding_scale=1.0)
stereo_wav = torch.tensor(mono_wav).repeat(2,1)
torchaudio.save(f"{char_name}|{sample.file_name}",stereo_wav,sample_rate=24000)
path = f"./test/{char_name}|{i}-text|{sample.file_name}"
torchaudio.save(path,stereo_wav,sample_rate=24000)
self.sample_ood_voice(file=path,sample_rate=24000,character=char_name,caption=f"Text: {text} | Reference Text:{sample.ref_text}")
count += 1
if count == top:
break