From 541b2293c66fd70a8539198e74d182c9fdf137ed Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Mon, 2 Dec 2019 14:26:18 +0800 Subject: [PATCH] Add more info in init (#4015) --- PaddleNLP/PaddleLARK/BERT/utils/init.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PaddleNLP/PaddleLARK/BERT/utils/init.py b/PaddleNLP/PaddleLARK/BERT/utils/init.py index 3844d012..27f0a75f 100644 --- a/PaddleNLP/PaddleLARK/BERT/utils/init.py +++ b/PaddleNLP/PaddleLARK/BERT/utils/init.py @@ -44,7 +44,9 @@ def init_checkpoint(exe, init_checkpoint_path, main_program, use_fp16=False): def existed_persitables(var): if not fluid.io.is_persistable(var): return False - return os.path.exists(os.path.join(init_checkpoint_path, var.name)) + if os.path.exists(os.path.join(init_checkpoint_path, var.name)): + print("INIT {}".format(var.name)) + return True fluid.io.load_vars( exe, @@ -67,7 +69,12 @@ def init_pretraining_params(exe, def existed_params(var): if not isinstance(var, fluid.framework.Parameter): return False - return os.path.exists(os.path.join(pretraining_params_path, var.name)) + if os.path.exists(os.path.join(pretraining_params_path, var.name)): + print("INIT {}".format(var.name)) + return True + else: + print("SKIP {}".format(var.name)) + return False fluid.io.load_vars( exe, -- GitLab