Pytorch Lightning中的tqdm进度栏有很多问题:
INFO:root: Name Type Params
0 l1 Linear 7 K
Epoch 2: 56%|████████████▊ | 2093/3750 [00:05<00:03, 525.47batch/s, batch_nb=1874, loss=0.714, training_loss=0.4, v_nb=51]
INFO:root: Name Type Params
0 l1 Linear 7 K
Epoch 1: 50%|█████ | 1875/3750 [00:05<00:05, 322.34batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 50%|█████ | 1879/3750 [00:05<00:05, 319.41batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 52%|█████▏ | 1942/3750 [00:05<00:04, 374.05batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 53%|█████▎ | 2005/3750 [00:05<00:04, 425.01batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 55%|█████▌ | 2068/3750 [00:05<00:03, 470.56batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 57%|█████▋ | 2131/3750 [00:05<00:03, 507.69batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 59%|█████▊ | 2194/3750 [00:06<00:02, 538.19batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 60%|██████ | 2257/3750 [00:06<00:02, 561.20batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 62%|██████▏ | 2320/3750 [00:06<00:02, 579.22batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 64%|██████▎ | 2383/3750 [00:06<00:02, 591.58batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 65%|██████▌ | 2445/3750 [00:06<00:02, 599.77batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 67%|██████▋ | 2507/3750 [00:06<00:02, 605.00batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 69%|██████▊ | 2569/3750 [00:06<00:01, 607.04batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
Epoch 1: 70%|███████ | 2633/3750 [00:06<00:01, 613.98batch/s, batch_nb=1874, loss=1.534, training_loss=1.72, v_nb=49]
我想知道这些问题是否可以解决,或者我如何禁用进度条,而是在屏幕上打印一些日志详细信息。
答案 0 :(得分:2)
我想知道这些问题是否可以解决,否则如何禁用进度条,而只是在屏幕上打印一些日志详细信息。
据我所知,这个问题还没有解决。 pl 团队指出这是“TQDM 相关的事情”,他们对此无能为力。也许您想阅读this issue
我的临时修复是:
from tqdm import tqdm
class LitProgressBar(ProgressBar):
def init_validation_tqdm(self):
bar = tqdm(
disable=True,
)
return bar
bar = LitProgressBar()
trainer = Trainer(callbacks=[bar])
此方法只是禁用验证进度条,并允许您保留正确的训练条 [refer 1 和 2]。请注意,使用 progress_bar_refresh_rate=0
将禁用所有进度条的更新。
答案 1 :(得分:1)
在Trainer中使用此命令show_progress_bar = False
答案 2 :(得分:1)
F.Y.I。 progress_bar_refresh_rate=0
自0.7.2版起已弃用,但您可以使用res = []
for inner_list in l:
inner = []
for el in inner_list:
if type(el) == list:
inner.extend(el)
else:
inner.append(el)
if not (inner in res):
res.append(inner)
答案 3 :(得分:0)
如果你想关闭进度条,你可以在 Trainer 中使用它。将“progress_bar_refresh_rate”的参数设置为 0 将禁用进度条,但如果您在回调中指定自己的进度条,则此设置将被省略。请注意,pl 是 pytorch 闪电模块(import pytorch_lightning as pl),可能与您的风格不同。
trainer = pl.Trainer(..., progress_bar_refresh_rate=0)