提交 a75a614a 编写于 作者: W WenmuZhou

修复test_loader函数不可用的问题

上级 8c000977
...@@ -88,20 +88,23 @@ def main(config, device, logger, vdl_writer): ...@@ -88,20 +88,23 @@ def main(config, device, logger, vdl_writer):
best_model_dict, logger, vdl_writer) best_model_dict, logger, vdl_writer)
def test_reader(config, place, logger): def test_reader(config, place, logger, global_config):
train_loader = build_dataloader(config['TRAIN'], place) train_loader, _ = build_dataloader(
config['TRAIN'], place, global_config=global_config)
import time import time
starttime = time.time() starttime = time.time()
count = 0 count = 0
try: try:
for data in train_loader(): for data in train_loader:
count += 1 count += 1
if count % 1 == 0: if count % 1 == 0:
batch_time = time.time() - starttime batch_time = time.time() - starttime
starttime = time.time() starttime = time.time()
logger.info("reader: {}, {}, {}".format(count, logger.info("reader: {}, {}, {}".format(
len(data), batch_time)) count, len(data[0]), batch_time))
except Exception as e: except Exception as e:
import traceback
traceback.print_exc()
logger.info(e) logger.info(e)
logger.info("finish reader: {}, Success!".format(count)) logger.info("finish reader: {}, Success!".format(count))
...@@ -130,7 +133,7 @@ def dis_main(): ...@@ -130,7 +133,7 @@ def dis_main():
device)) device))
main(config, device, logger, vdl_writer) main(config, device, logger, vdl_writer)
# test_reader(config, place, logger) # test_reader(config, device, logger, config['Global'])
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册