减少训练过程中的输出频率
修改了训练脚本,将训练过程中的进度输出频率从每批输出改为每100批输出一次,以减少输出量,提高训练效率。
This commit is contained in:
parent
87fa4dfcc6
commit
d65f6ec3ce
22
train.py
22
train.py
@ -222,17 +222,19 @@ for epoch in range(num_epochs):
|
||||
time_left = datetime.timedelta(seconds=batches_left * (time.time() - prev_time))
|
||||
epoch_time = time.time() - prev_time
|
||||
prev_time = time.time()
|
||||
sys.stdout.write(
|
||||
"\r[Epoch %d/%d] [Batch %d/%d] [loss: %f] ETA: %.10s"
|
||||
% (
|
||||
epoch,
|
||||
num_epochs,
|
||||
i,
|
||||
len(loader['train']),
|
||||
loss.item(),
|
||||
time_left,
|
||||
if step % 100 == 0:
|
||||
sys.stdout.write(
|
||||
"\r[Epoch %d/%d] [Batch %d/%d] [loss: %f] ETA: %.10s"
|
||||
% (
|
||||
epoch,
|
||||
num_epochs,
|
||||
i,
|
||||
len(loader['train']),
|
||||
loss.item(),
|
||||
time_left,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# adjust the learning rate
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user