这确实是更多的美学,但它一直在唠叨我。我似乎无法理解我的 jupyter notebook 中的这部分输出来自哪里(图中用红色箭头标记)它几乎像口吃一样出现在每个纪元之前。任何提示或解决方案将不胜感激。这是我的代码的摘录。for epoch in range(epochs): start_time = time.time() epochs_left = epochs - epoch print('training model over %d epochs... There are %d epochs left...' % (epochs,epochs_left)) learning_rate = learning_rate_final + (learning_rate_... train_loss, train_acc = 0, 0 for image_path, label in tqdm(train_list, 'training for epoch %d' % epoch): loss_, acc = train(sess, image_path, label, learning_rate) train_loss += loss_ train_acc += acc train_loss, train_acc = train_loss / ...谢谢。
1 回答
婷婷同学_
TA贡献1844条经验 获得超8个赞
正如我在评论中所写,您可以刷新缓冲区,以便在打印进度条之前打印消息。
print('training model over %d epochs... There are %d epochs left...' % (epochs,epochs_left), flush=True)
您还可以使用 f-strings 缩短此行。
print(f"training model over {epochs} epochs... There are {epochs_left} epochs left...", flush=True)
添加回答
举报
0/150
提交
取消