0
$\begingroup$

I am a very beginner in deep learning and am playing with voice cloning project. I trained my dataset and used the trained model to synthesize some sentences and was surprised to get a very different output each time I ran the synthesis (output ranging for very good quality to very poor with unintelligible content).

I understood that this was due to the initial state of the model that was set up randomly thanks to a random seed, but in the project I use the seed is fixed to 1234 and used to initialize the random generators.

Can it be that with the same initial seed the outputs differ at inference time for the same input ? Does it have to do with a bad dataset ? What are the reasons for that ?

Thank you

$\endgroup$
2

1 Answer 1

2
$\begingroup$

In PyTorch a typical gotcha that leads to this behavior is forgetting to set the model in evaluation mode when doing inference. You can do this by invoking .eval() on the model.

Evaluation mode changes the behavior of some stochastic elements that can lead to not deterministic results, like batch normalization and dropout.

Apart from that, unless you have explicitly stochastic elements in your model (e.g. explicit sampling from distributions), you should get deterministic results.

$\endgroup$
1
  • $\begingroup$ You must be right, having a look at source code I can't see an eval() when loading the model (running on CPU only) whereas I can see an model.cuda().eval().half() when CUDA is available. I will test it on a CUDA capable machine. Thank you anyway for having pointed me towards this fact. $\endgroup$
    – Cara Duf
    Dec 21, 2021 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.