Spaces:
Running
Running
Update src/rmvpe.py
Browse files- src/rmvpe.py +8 -8
src/rmvpe.py
CHANGED
|
@@ -350,14 +350,14 @@ class RMVPE:
|
|
| 350 |
self.cents_mapping = np.pad(cents_mapping, (4, 4)) # 368
|
| 351 |
|
| 352 |
def mel2hidden(self, mel):
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
|
| 362 |
def decode(self, hidden, thred=0.03):
|
| 363 |
cents_pred = self.to_local_average_cents(hidden, thred=thred)
|
|
|
|
| 350 |
self.cents_mapping = np.pad(cents_mapping, (4, 4)) # 368
|
| 351 |
|
| 352 |
def mel2hidden(self, mel):
|
| 353 |
+
with torch.no_grad():
|
| 354 |
+
n_frames = mel.shape[-1]
|
| 355 |
+
mel = mel.float() # Convert mel tensor to 'Float'
|
| 356 |
+
mel = F.pad(
|
| 357 |
+
mel, (0, 32 * ((n_frames - 1) // 32 + 1) - n_frames), mode="reflect"
|
| 358 |
+
)
|
| 359 |
+
hidden = self.model(mel)
|
| 360 |
+
return hidden[:, :n_frames]
|
| 361 |
|
| 362 |
def decode(self, hidden, thred=0.03):
|
| 363 |
cents_pred = self.to_local_average_cents(hidden, thred=thred)
|