Unverified Commit 3e4eec47 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Kill async pushes when calling push_to_hub with blocking=True (#16755)

parent c21e1071
...@@ -2904,6 +2904,11 @@ class Trainer: ...@@ -2904,6 +2904,11 @@ class Trainer:
if not self.is_world_process_zero(): if not self.is_world_process_zero():
return return
# Cancel any async push in progress if blocking=True. The commits will all be pushed together.
if blocking and self.push_in_progress is not None and not self.push_in_progress.is_done:
self.push_in_progress._process.kill()
self.push_in_progress = None
git_head_commit_url = self.repo.push_to_hub( git_head_commit_url = self.repo.push_to_hub(
commit_message=commit_message, blocking=blocking, auto_lfs_prune=True commit_message=commit_message, blocking=blocking, auto_lfs_prune=True
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment