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

Fix model save (#1325)

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