未验证 提交 f0050fd5 编写于 作者: Q qingqing01 提交者: GitHub

Fix model save (#1325)

上级 1388a943
......@@ -285,7 +285,8 @@ def train(settings,
try:
enqueuer = GeneratorEnqueuer(
train_generator(settings, file_list, batch_size, shuffle),
use_multiprocessing=use_multiprocessing)
use_multiprocessing=use_multiprocessing,
wait_time=0.5)
enqueuer.start(max_queue_size=max_queue, workers=num_workers)
generator_output = None
while True:
......@@ -294,7 +295,7 @@ def train(settings,
generator_output = enqueuer.queue.get()
break
else:
time.sleep(0.02)
time.sleep(0.5)
yield generator_output
generator_output = None
finally:
......
......@@ -167,7 +167,7 @@ def train(args, config, train_params, train_file_list):
shutil.rmtree(model_path)
print('save models to %s' % (model_path))
fluid.io.save_persistables(exe, model_path)
fluid.io.save_persistables(exe, model_path, main_program=program)
train_py_reader.start()
try:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册