How to use early stopping in fastai.
Found a relevant thread Wiki: Fastai Library Feature Requests but it doesn’t mention how can we use early stopping.
1 Like
It’s not implemented yet - but you could do so easily enough with the callback mechanism in fastai.
2 Likes
Would be handy for the lesson 1 (and probably later, though at that point doing it yourself via callback is probably cool, but that’s how far I am). My “own” model got crazily overfitted quite soon with so few images.
Found this paper which describes a variety of useful early stopping methods.
@irshaduetian I was able to use early stopping with the following two lines (example for a text classifier):
from fastai.callbacks import *
learn = text_classifier_learner(data_clas, AWD_LSTM, drop_mult=0.1,callback_fns=[partial(EarlyStoppingCallback, monitor=‘accuracy’, min_delta=0.01, patience=2)])