I mean that in that post the Imbalance is discussed, and I provide a working code to compute the loss inside the DataParallel as in the blog @Thomas_Wolf suggested.
Just saying that, in case the code provided there does not work for you, you can try mine one.
I didn’t checked the blog’s code.