You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
May I ask how to fix the stochastic noise during inference time? I want some generated audio to be reproducable, thus need to fix the random noise part.
Currently it seems I can only control the noise scale.
always using same input in mode.py infer function: z_p = m_p + torch.randn_like(m_p) * torch.exp(logs_p) * noise_scale
you can replace torch.randn_like with same fixed input:
always using same input in mode.py infer function: z_p = m_p + torch.randn_like(m_p) * torch.exp(logs_p) * noise_scale
you can replace torch.randn_like with same fixed input:
print torch.randn_like(m_p) and save
always use results of 1 as input tensor
Thanks for the reply.
But it seems the dimension of m_p varies every time. In this case, it's impossible to replace torch.randn_like(m_p) as a constant tensor.
You can see the dimension of m_p that I print out several times.
To my understanding, setting the hyperparameter noise_scale_w to be zero can enable the dimension of m_p to be a constant value. But if noise_scale_w is not equal to 0, is there any way to reproduce the same generated audio?
Because you use a StochasticDurationPredictor for duration prediction and it also contains a sample process like this e_q = torch.randn(w.size(0), 2, w.size(2)).to(device=x.device, dtype=x.dtype) * x_mask
you should also fixed this like above.
Just set the seed in torch when you input your data. Use branch rng if you want the other components to be unaffected by set seed.
It will always give you the same output from the same input.
Activity
BridgetteSong commentedon Jul 27, 2021
always using same input in mode.py
inferfunction:z_p = m_p + torch.randn_like(m_p) * torch.exp(logs_p) * noise_scaleyou can replace
torch.randn_likewith same fixed input:xinghua-qu commentedon Jul 27, 2021
Thanks for the reply.
But it seems the dimension of
m_pvaries every time. In this case, it's impossible to replacetorch.randn_like(m_p)as a constant tensor.You can see the dimension of
m_pthat I print out several times.To my understanding, setting the hyperparameter
noise_scale_wto be zero can enable the dimension ofm_pto be a constant value. But ifnoise_scale_wis not equal to0, is there any way to reproduce the same generated audio?BridgetteSong commentedon Jul 27, 2021
Because you use a
StochasticDurationPredictorfor duration prediction and it also contains a sample process like thise_q = torch.randn(w.size(0), 2, w.size(2)).to(device=x.device, dtype=x.dtype) * x_maskyou should also fixed this like above.
CookiePPP commentedon Jul 27, 2021
Just set the seed in torch when you input your data. Use branch rng if you want the other components to be unaffected by set seed.
It will always give you the same output from the same input.
CookiePPP commentedon Jul 27, 2021
with torch.random.fork_rn:https://pytorch.org/docs/stable/random.html
And
torch.manual_seed(0)https://pytorch.org/docs/stable/notes/randomness.html
When you call the model forward should be enough for reproduction.