What is the Default Loss Function?

I’ve been looking around, and for the life of me I cannot figure out what loss function is used. I saw this post, but fastai seems to have changed since that post because nlp.py is in the old directory. I’m using an AWD_LSTM language_model_learner and text_classifier_learner, but I’m also interested in the loss function for transformer and transformerxl

your leaner object has the loss function. learn.loss_func should give you your loss function :slight_smile:

1 Like

Thanks! Is that in the docs anywhere?

Lists everything about Learner: https://docs.fast.ai/basic_train.html#Learner

You can see source code if you put “??” after a function/class. Don’t dive too deeply in the beginning though.

Ahh I see, it just wasn’t immediately obvious to me that .loss_func was actually an attribute of a Learner. I see now that you can check source code through the docs, which is a handy feature