diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index b9203024f1b333..0468b74360ef98 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -1650,6 +1650,7 @@ def train( def _inner_training_loop( self, batch_size=None, args=None, resume_from_checkpoint=None, trial=None, ignore_keys_for_eval=None ): + self.accelerator.free_memory() self._train_batch_size = batch_size logger.debug(f"Currently training with a batch size of: {self._train_batch_size}") # Data loader and number of training steps