Unverified Commit 7d4fe85e authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix psuh_to_hub in Trainer when nothing needs pushing (#23751)

parent 06c28cd0
...@@ -3699,9 +3699,10 @@ class Trainer: ...@@ -3699,9 +3699,10 @@ class Trainer:
commit_message = f"Training in progress, step {self.state.global_step}" commit_message = f"Training in progress, step {self.state.global_step}"
else: else:
commit_message = f"Training in progress, epoch {int(self.state.epoch)}" commit_message = f"Training in progress, epoch {int(self.state.epoch)}"
_, self.push_in_progress = self.repo.push_to_hub( push_work = self.repo.push_to_hub(commit_message=commit_message, blocking=False, auto_lfs_prune=True)
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: except Exception as e:
logger.error(f"Error when pushing to hub: {e}") logger.error(f"Error when pushing to hub: {e}")
finally: finally:
......
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