Spaces:
Running
on
Zero
Running
on
Zero
Update modules/length_regulator.py
Browse files
modules/length_regulator.py
CHANGED
@@ -126,9 +126,9 @@ class InterpolateRegulator(nn.Module):
|
|
126 |
if f0 is None:
|
127 |
x = x + self.f0_mask.unsqueeze(-1)
|
128 |
else:
|
129 |
-
quantized_f0 = torch.bucketize(f0, self.f0_bins.to(f0.device)) # (N, T)
|
130 |
-
|
131 |
-
|
132 |
f0_emb = self.f0_embedding(quantized_f0)
|
133 |
f0_emb = F.interpolate(f0_emb.transpose(1, 2).contiguous(), size=ylens.max(), mode='nearest')
|
134 |
x = x + f0_emb
|
|
|
126 |
if f0 is None:
|
127 |
x = x + self.f0_mask.unsqueeze(-1)
|
128 |
else:
|
129 |
+
#quantized_f0 = torch.bucketize(f0, self.f0_bins.to(f0.device)) # (N, T)
|
130 |
+
quantized_f0 = f0_to_coarse(f0, self.n_f0_bins)
|
131 |
+
quantized_f0 = quantized_f0.clamp(0, self.n_f0_bins - 1).long()
|
132 |
f0_emb = self.f0_embedding(quantized_f0)
|
133 |
f0_emb = F.interpolate(f0_emb.transpose(1, 2).contiguous(), size=ylens.max(), mode='nearest')
|
134 |
x = x + f0_emb
|