未验证 提交 3b96e3d2 编写于 作者: T tangwei12 提交者: GitHub

fix FetchHandler (#20900)

* bug fix, test=develop
上级 2dd9bc71
...@@ -987,11 +987,6 @@ class Executor(object): ...@@ -987,11 +987,6 @@ class Executor(object):
dataset._prepare_to_run() dataset._prepare_to_run()
if fetch_handler is not None:
fetch_instance = fetch_handler
else:
fetch_instance = FetchHandler([])
scope, trainer = self._prepare_trainer( scope, trainer = self._prepare_trainer(
program=program, program=program,
dataset=dataset, dataset=dataset,
...@@ -1006,17 +1001,26 @@ class Executor(object): ...@@ -1006,17 +1001,26 @@ class Executor(object):
trainer._gen_trainer_desc() trainer._gen_trainer_desc()
self._dump_debug_info(program=program, trainer=trainer) self._dump_debug_info(program=program, trainer=trainer)
dataset._dynamic_adjust_before_train(trainer.proto_desc.thread_num)
trainer_instance = self._default_executor.init_for_dataset( trainer_instance = self._default_executor.init_for_dataset(
program.desc, trainer._desc(), scope, dataset.dataset) program.desc, trainer._desc(), scope, dataset.dataset)
scope0 = trainer_instance.get_worker_scope(0) if fetch_handler is not None:
scope0 = trainer_instance.get_worker_scope(0)
fetch_monitor = FetchHandlerMonitor(scope0, fetch_handler)
fetch_monitor.start()
self._default_executor.run_from_dataset(trainer_instance)
fetch_monitor = FetchHandlerMonitor(scope0, fetch_instance) fetch_monitor.stop()
fetch_monitor.start() else:
self._default_executor.run_from_dataset(trainer_instance)
fetch_monitor.stop() self._default_executor.run_from_dataset(trainer_instance)
dataset._dynamic_adjust_after_train()
dataset._finish_to_run() dataset._finish_to_run()
return None return None
def infer_from_dataset(self, def infer_from_dataset(self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册