Skip to content

Commit

Permalink
Fix ADaMoS wav2spec
Browse files Browse the repository at this point in the history
  • Loading branch information
leng-yue committed Aug 8, 2023
1 parent 8aaa50f commit dcc4972
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fish_diffusion/modules/vocoders/adamos/adamos.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(
post_conv_kernel_size=13,
)
self.use_natural_log = use_natural_log
self.sampling_rate = 44100

ckpt_state = torch.load(checkpoint_path, map_location="cpu")

Expand Down Expand Up @@ -91,11 +92,11 @@ def device(self):

def wav2spec(self, wav_torch, sr=None, key_shift=0, speed=1.0):
if sr is None:
sr = self.h.sampling_rate
sr = self.sampling_rate

if sr != self.h.sampling_rate:
if sr != self.sampling_rate:
_wav_torch = librosa.resample(
wav_torch.cpu().numpy(), orig_sr=sr, target_sr=self.h.sampling_rate
wav_torch.cpu().numpy(), orig_sr=sr, target_sr=self.sampling_rate
)
wav_torch = torch.from_numpy(_wav_torch).to(wav_torch.device)

Expand Down

0 comments on commit dcc4972

Please sign in to comment.