Skip to content

Commit

Permalink
Fix resuming training for Windows (huggingface#6847)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgugger authored and Zigur committed Oct 26, 2020
1 parent 96b7d83 commit 1ab2fd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def train(self, model_path: Optional[str] = None, trial: Union["optuna.Trial", D
if model_path is not None:
# set global_step to global_step of last saved checkpoint from model path
try:
self.global_step = int(model_path.split("-")[-1].split("/")[0])
self.global_step = int(model_path.split("-")[-1].split(os.path.sep)[0])
epochs_trained = self.global_step // (len(train_dataloader) // self.args.gradient_accumulation_steps)
steps_trained_in_current_epoch = self.global_step % (
len(train_dataloader) // self.args.gradient_accumulation_steps
Expand Down

0 comments on commit 1ab2fd1

Please sign in to comment.