Fix no_trainer examples to properly calculate the number of samples (#17046)

* Update all examples to properly calculate progress bar
This commit is contained in:
Zachary Mueller
2022-05-02 11:56:25 -04:00
committed by GitHub
parent 35d48db881
commit f275e593bf
11 changed files with 44 additions and 0 deletions

View File

@@ -532,6 +532,10 @@ def main():
model, optimizer, train_dataloader, eval_dataloader, lr_scheduler
)
# We need to recalculate our total training steps as the size of the training dataloader may have changed.
num_update_steps_per_epoch = math.ceil(len(train_dataloader) / args.gradient_accumulation_steps)
args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch
# Figure out how many steps we should save the Accelerator states
if hasattr(args.checkpointing_steps, "isdigit"):
checkpointing_steps = args.checkpointing_steps