Merge pull request #2325 from littletomatodonkey/dyg/fix_log
fix logger info for empty log
This commit is contained in:
commit
76946e8372
|
@ -237,8 +237,9 @@ def train(config,
|
||||||
vdl_writer.add_scalar('TRAIN/{}'.format(k), v, global_step)
|
vdl_writer.add_scalar('TRAIN/{}'.format(k), v, global_step)
|
||||||
vdl_writer.add_scalar('TRAIN/lr', lr, global_step)
|
vdl_writer.add_scalar('TRAIN/lr', lr, global_step)
|
||||||
|
|
||||||
if dist.get_rank(
|
if dist.get_rank() == 0 and (
|
||||||
) == 0 and global_step > 0 and global_step % print_batch_step == 0:
|
(global_step > 0 and global_step % print_batch_step == 0) or
|
||||||
|
(idx >= len(train_dataloader) - 1)):
|
||||||
logs = train_stats.log()
|
logs = train_stats.log()
|
||||||
strs = 'epoch: [{}/{}], iter: {}, {}, reader_cost: {:.5f} s, batch_cost: {:.5f} s, samples: {}, ips: {:.5f}'.format(
|
strs = 'epoch: [{}/{}], iter: {}, {}, reader_cost: {:.5f} s, batch_cost: {:.5f} s, samples: {}, ips: {:.5f}'.format(
|
||||||
epoch, epoch_num, global_step, logs, train_reader_cost /
|
epoch, epoch_num, global_step, logs, train_reader_cost /
|
||||||
|
|
|
@ -52,7 +52,10 @@ def main(config, device, logger, vdl_writer):
|
||||||
train_dataloader = build_dataloader(config, 'Train', device, logger)
|
train_dataloader = build_dataloader(config, 'Train', device, logger)
|
||||||
if len(train_dataloader) == 0:
|
if len(train_dataloader) == 0:
|
||||||
logger.error(
|
logger.error(
|
||||||
'No Images in train dataset, please check annotation file and path in the configuration file'
|
"No Images in train dataset, please ensure\n" +
|
||||||
|
"\t1. The images num in the train label_file_list should be larger than or equal with batch size.\n"
|
||||||
|
+
|
||||||
|
"\t2. The annotation file and path in the configuration file are provided normally."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue