From 5ae7e0d9b0ddba3d0e76127006d466c53b787b9b Mon Sep 17 00:00:00 2001 From: James Betker Date: Wed, 29 Dec 2021 14:44:46 -0700 Subject: [PATCH] Fix gapping bug in voice2voice clip --- codes/models/gpt_voice/voice_voice_clip.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/codes/models/gpt_voice/voice_voice_clip.py b/codes/models/gpt_voice/voice_voice_clip.py index 1447e99f..51b631d6 100644 --- a/codes/models/gpt_voice/voice_voice_clip.py +++ b/codes/models/gpt_voice/voice_voice_clip.py @@ -60,8 +60,8 @@ class VoiceCLIP(nn.Module): # Introduce a random gap between the two clips. potential_gap = half_length // 4 - if potential_gap > 0: - gap = random.randint(0, potential_gap) + gap = random.randint(0, potential_gap) + if gap > 0: first_half = first_half[:, :, :-gap] second_half = second_half[:, :, gap:] @@ -111,6 +111,7 @@ def register_voice_to_voice_clip(opt_net, opt): if __name__ == '__main__': clip = VoiceCLIP() - clip(torch.randn((2,80,200)), - torch.randint(0,200*1024,(2,)), - return_loss=True) \ No newline at end of file + for k in range(1000): + clip(torch.randn((2,80,156)), + torch.randint(130*1024,156*1024,(2,)), + return_loss=True) \ No newline at end of file