Spaces:
Sleeping
Sleeping
Hecheng0625
commited on
Commit
·
e67cc17
1
Parent(s):
173e528
Update models/tts/naturalspeech2/diffusion.py
Browse files
models/tts/naturalspeech2/diffusion.py
CHANGED
@@ -3,6 +3,7 @@ import torch.nn as nn
|
|
3 |
import numpy as np
|
4 |
import torch.nn.functional as F
|
5 |
from models.tts.naturalspeech2.wavenet import WaveNet
|
|
|
6 |
|
7 |
|
8 |
class Diffusion(nn.Module):
|
@@ -80,7 +81,7 @@ class Diffusion(nn.Module):
|
|
80 |
def reverse_diffusion(self, z, x_mask, cond, n_timesteps, spk_query_emb):
|
81 |
h = 1.0 / max(n_timesteps, 1)
|
82 |
xt = z
|
83 |
-
for i in range(n_timesteps):
|
84 |
t = (1.0 - (i + 0.5) * h) * torch.ones(
|
85 |
z.shape[0], dtype=z.dtype, device=z.device
|
86 |
)
|
@@ -102,7 +103,7 @@ class Diffusion(nn.Module):
|
|
102 |
):
|
103 |
h = t_start / max(n_timesteps, 1)
|
104 |
xt = z
|
105 |
-
for i in range(n_timesteps):
|
106 |
t = (t_start - (i + 0.5) * h) * torch.ones(
|
107 |
z.shape[0], dtype=z.dtype, device=z.device
|
108 |
)
|
|
|
3 |
import numpy as np
|
4 |
import torch.nn.functional as F
|
5 |
from models.tts.naturalspeech2.wavenet import WaveNet
|
6 |
+
from tqdm import tqdm
|
7 |
|
8 |
|
9 |
class Diffusion(nn.Module):
|
|
|
81 |
def reverse_diffusion(self, z, x_mask, cond, n_timesteps, spk_query_emb):
|
82 |
h = 1.0 / max(n_timesteps, 1)
|
83 |
xt = z
|
84 |
+
for i in tqdm(range(n_timesteps)):
|
85 |
t = (1.0 - (i + 0.5) * h) * torch.ones(
|
86 |
z.shape[0], dtype=z.dtype, device=z.device
|
87 |
)
|
|
|
103 |
):
|
104 |
h = t_start / max(n_timesteps, 1)
|
105 |
xt = z
|
106 |
+
for i in tqdm(range(n_timesteps)):
|
107 |
t = (t_start - (i + 0.5) * h) * torch.ones(
|
108 |
z.shape[0], dtype=z.dtype, device=z.device
|
109 |
)
|