From 1e48cb3b67445d9470dd9d0e7ff193c9773967fc Mon Sep 17 00:00:00 2001 From: leegang Date: Tue, 10 Sep 2024 18:39:20 +0800 Subject: [PATCH 1/2] Update nodes.py fix the RuntimeError: stack expects each tensor to be equal size, but got [1, 88865] at entry 0 and [1, 149466] at entry 1 #45 --- nodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index ba36f30..5406a83 100644 --- a/nodes.py +++ b/nodes.py @@ -167,7 +167,7 @@ class CosyVoiceNode: set_all_random_seed(seed) print(self.model_dir) output = self.cosyvoice.inference_instruct(tts_text, sft_dropdown, instruct_text) - output_list =[] + output_list = [] for out_dict in output: output_numpy = out_dict['tts_speech'].squeeze(0).numpy() * 32768 output_numpy = output_numpy.astype(np.int16) @@ -176,7 +176,7 @@ class CosyVoiceNode: output_list.append(torch.Tensor(output_numpy/32768).unsqueeze(0)) t1 = ttime() print("cost time \t %.3f" % (t1-t0)) - audio = {"waveform": torch.stack(output_list),"sample_rate":target_sr} + audio = {"waveform": torch.cat(.unsqueeze(0),dim=1).unsqueeze(0),"sample_rate":target_sr} return (audio,) class CosyVoiceDubbingNode: @@ -343,4 +343,4 @@ class LoadSRT: def load_srt(self, srt): srt_path = folder_paths.get_annotated_filepath(srt) - return (srt_path,) \ No newline at end of file + return (srt_path,) From a19481a5d5610bb21973355887496a10d4b9907c Mon Sep 17 00:00:00 2001 From: leegang Date: Tue, 10 Sep 2024 19:19:22 +0800 Subject: [PATCH 2/2] Update nodes.py --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 5406a83..b7edcef 100644 --- a/nodes.py +++ b/nodes.py @@ -176,7 +176,7 @@ class CosyVoiceNode: output_list.append(torch.Tensor(output_numpy/32768).unsqueeze(0)) t1 = ttime() print("cost time \t %.3f" % (t1-t0)) - audio = {"waveform": torch.cat(.unsqueeze(0),dim=1).unsqueeze(0),"sample_rate":target_sr} + audio = {"waveform": torch.cat(output_list,dim=1).unsqueeze(0),"sample_rate":target_sr} return (audio,) class CosyVoiceDubbingNode: