The trainer (pt, tf) is an easy access point for users who rather not spend too much time building their own trainer class but prefer an out-of-the-box solution. Even though transformers was never meant to be a fully fletched training library, it might please users to add an additional feature: early stopping.
Early stopping ensures that the trainer does not needlessly keep training when the loss does not improve. This saves time, money, and let's not forget the trees. 馃槈 Performance-wise this should not lead to different results.
At the moment I cannot work on this, but here are my thoughts:
evaluate_during_training is enabled.tf.keras.callbacks.EarlyStopping.This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Looking at the interest this topic has, I am bumping it to re-open it.
Hi,
So when #4186 is closed, this will close as well? Or is there any more changes expected. on this issue, apart from what #4186 adds?
Thanks
If I've understood things correctly, I think #4186 only addresses the Pytorch implementation of the trainer. @BramVanroy if that's the case I'm happy to work on implementing this feature in Tensorflow (trainer_tf.py).
@san7988 @KMFODA This issue should not directly be closed when that PR is merged because as @KMFODA mentions, it only seems to address PyTorch. A PR for Tensorflow is also welcome!
Thanks for clarifying @BramVanroy. Apologies I was out for the past month due to a personal issue. I'll submit a PR for Tensorflow early stopping now.
An early stopping callback has now been introduced in the PyTorch trainer by @cbrochtrup! 馃憦
AFAIK the implementation the TF Trainer is still under way (https://github.com/huggingface/transformers/pull/7533) so I'll keep this topic open for now.
Most helpful comment
Looking at the interest this topic has, I am bumping it to re-open it.