From bc4fad3259d6bfe9df16303a46e22b6baccca547 Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Wed, 6 Nov 2019 11:42:34 +0800 Subject: [PATCH] Add check for pretrained model. --- PaddleSlim/classification/pruning/compress.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PaddleSlim/classification/pruning/compress.py b/PaddleSlim/classification/pruning/compress.py index 77f4f83a..506a5cda 100644 --- a/PaddleSlim/classification/pruning/compress.py +++ b/PaddleSlim/classification/pruning/compress.py @@ -88,6 +88,7 @@ def compress(args): exe.run(fluid.default_startup_program()) if args.pretrained_model: + assert os.path.exists(args.pretrained_model), "pretrained_model is not exist!!!" def if_exist(var): return os.path.exists(os.path.join(args.pretrained_model, var.name)) fluid.io.load_vars(exe, args.pretrained_model, predicate=if_exist) -- GitLab