Do you get a NaN output from your model if you are using samples from certain folders or what do you mean by:



 monster:

I am getting nan loss value in some folders


If your model is returning NaNs, you could set torch.autograd.detect_anomaly(True) at the beginning of your script to get a stack trace, which would hopefully point to the operation, which is creating the NaNs.