Skip to content

Commit

Permalink
Fix psuh_to_hub in Trainer when nothing needs pushing (huggingface#23751
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sgugger authored and novice03 committed Jun 23, 2023
1 parent ea2ce5f commit f27ccf2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3699,9 +3699,10 @@ def _push_from_checkpoint(self, checkpoint_folder):
commit_message = f"Training in progress, step {self.state.global_step}"
else:
commit_message = f"Training in progress, epoch {int(self.state.epoch)}"
_, self.push_in_progress = self.repo.push_to_hub(
commit_message=commit_message, blocking=False, auto_lfs_prune=True
)
push_work = self.repo.push_to_hub(commit_message=commit_message, blocking=False, auto_lfs_prune=True)
# Return type of `Repository.push_to_hub` is either None or a tuple.
if push_work is not None:
self.push_in_progress = push_work[1]
except Exception as e:
logger.error(f"Error when pushing to hub: {e}")
finally:
Expand Down

0 comments on commit f27ccf2

Please sign in to comment.