From 8bf673ff1692e22cd903d9cbdbf43d0eb1a8af34 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Tue, 12 Feb 2019 09:10:57 +0000 Subject: [PATCH] use fluid.io.load_vars --- fluid/PaddleCV/video/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fluid/PaddleCV/video/train.py b/fluid/PaddleCV/video/train.py index 3913e179..54b52529 100755 --- a/fluid/PaddleCV/video/train.py +++ b/fluid/PaddleCV/video/train.py @@ -152,7 +152,9 @@ def train(args): # if resume weights is given, load resume weights directly assert os.path.exists(args.resume), \ "Given resume weight dir {} not exist.".format(args.resume) - fluid.io.load_params(exe, args.resume, main_program=train_prog) + def if_exist(var): + return os.path.exists(os.path.join(args.resume, var.name)) + fluid.io.load_vars(exe, args.resume, predicate=if_exist, main_program=train_prog) else: # if not in resume mode, load pretrain weights if args.pretrain: -- GitLab