I have not figured it out yet. I tried a few different things but could not make it work. I hope someone explain using customized loss function with fastai in general because I see a few posts where people are struggling with it. It is an important topic as well because most of the real-life datasets are not balanced so we need to use weight-sensitive loss functions.