-
Hey there, I recently tested some models using asteroid. At some point I figured out that if i change the last few samples of my input audio, this affects the whole output (even the first samples). This was a bit puzzling, since i was using a model that was supposably causal in time and had no time trespassing component (e.g. SuDoRMRF). I am wondering why this is happening, i was testing several models and on all models the same happens (see attached code). Could this be due to normalisation inside the model? I tested this with some models. In the code below, there is no model state loaded, but the behaviour is the same, if a state is loaded.
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Thanks for opening this subject. Can you add screenshots of the plots please for everyone to see without the code? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the swift answer. Of course, see attached the output of the script executed for the DCUNet model. As shown in the code, the only difference in input1 and input2 are the last 1000 samples |
Beta Was this translation helpful? Give feedback.
-
Okay i think i found the problem. For training purposes most models perform batch normalization which takes into account future values for normalization. Does that sound right? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply, I'm not sure to understand what's happening, have you gone forward with the debugging? How does it go with |
Beta Was this translation helpful? Give feedback.
-
No problem.
The two things that model.eval() or the equivalent model.train(False) automatically take care of are:
So in my case, where I missed to set the model to evaluation-mode the normalization would be calculated based on the whole audio file, which meant that it looked like being non causal -> The output of the model was affected by all future content of the audio file. Switching the model to eval-mode, solves this issue and we get the output as expected. In any case, bottom line is to always call model.eval() for evaluation purposes, which is a trivial but important detail in hindsight. |
Beta Was this translation helpful? Give feedback.
No problem.
As mentioned above the model contains batch normalization. At the evaluation stage it is important to set batch normalization and dropout to evaluation-mode as mentioned in the pytorch documentation:
The two things that model.eval() or the equivalent model.train(False) automatically take care of are:
So in my case, where I missed to set the model to evaluation-mode the normalization …