os.makedirs(args.save_path, exist_ok=True)
running_loss = 0.0
train_begin = time.time()
for epoch in range(1, model_args.num_epochs + 1):
for i, batch in enumerate(dataloader):
optimizer.zero_grad()
After Change
if i % 100 == 0:
// print current time, running average, learning rate, iteration, epoch
print("[{}][Epoch: {:3d}][Iter: {:6d}][Loss: {:6f}][lr: {:7f}]".format(
datetime.datetime.utcnow() - train_begin, epoch,
(epoch - 1) * args.iter_per_epoch + i, running_loss,
optimizer.param_groups[0]["lr"]))