提交 e52126f8 编写于 作者: S Steffy-zxf 提交者: wuzewu

fix logger when using paddle 1.5/1.6 (#252)

上级 1152db58
...@@ -261,7 +261,7 @@ class BasicTask(object): ...@@ -261,7 +261,7 @@ class BasicTask(object):
var = self.env.main_program.global_block().vars[var_name] var = self.env.main_program.global_block().vars[var_name]
var.persistable = True var.persistable = True
# to avoid to print logger two times in result of the logger usage of paddle-fluid # to avoid to print logger two times in result of the logger usage of paddle-fluid 1.6
for handler in logging.root.handlers[:]: for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler) logging.root.removeHandler(handler)
...@@ -291,6 +291,10 @@ class BasicTask(object): ...@@ -291,6 +291,10 @@ class BasicTask(object):
self.exe.run(self.env.startup_program) self.exe.run(self.env.startup_program)
# to avoid to print logger two times in result of the logger usage of paddle-fluid 1.5
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
self._build_env_end_event() self._build_env_end_event()
@property @property
...@@ -588,6 +592,7 @@ class BasicTask(object): ...@@ -588,6 +592,7 @@ class BasicTask(object):
return self.finetune(do_eval=True) return self.finetune(do_eval=True)
def finetune(self, do_eval=False): def finetune(self, do_eval=False):
# Start to finetune # Start to finetune
with self.phase_guard(phase="train"): with self.phase_guard(phase="train"):
self.init_if_necessary() self.init_if_necessary()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册