Skip to content

Commit

Permalink
fix rmvpe inference bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yxlllc committed Jul 21, 2023
1 parent 599add9 commit bb99d11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions encoder/rmvpe/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, model_path, hop_length=160):
self.resample_kernel = {}
model = E2E0(4, 1, (2, 2))
ckpt = torch.load(model_path)
model.load_state_dict(ckpt['model'])
model.load_state_dict(ckpt['model'], strict=False)
model.eval()
self.model = model
self.mel_extractor = MelSpectrogram(N_MELS, SAMPLE_RATE, WINDOW_LENGTH, hop_length, None, MEL_FMIN, MEL_FMAX)
Expand All @@ -21,7 +21,7 @@ def __init__(self, model_path, hop_length=160):
def mel2hidden(self, mel):
with torch.no_grad():
n_frames = mel.shape[-1]
mel = F.pad(mel, (0, 32 * ((n_frames - 1) // 32 + 1) - n_frames), mode='reflect')
mel = F.pad(mel, (0, 32 * ((n_frames - 1) // 32 + 1) - n_frames), mode='constant')
hidden = self.model(mel)
return hidden[:, :n_frames]

Expand Down

0 comments on commit bb99d11

Please sign in to comment.