From b464f689d5e125ef7e74610ed354d7bcdfbb76e7 Mon Sep 17 00:00:00 2001 From: Guanghua Yu <742925032@qq.com> Date: Thu, 14 May 2020 16:24:24 +0800 Subject: [PATCH] fix check_version in some script (#670) --- slim/distillation/distill.py | 3 ++- slim/extensions/distill_pruned_model/distill_pruned_model.py | 3 ++- slim/prune/export_model.py | 3 ++- slim/quantization/export_model.py | 3 ++- slim/sensitive/sensitive.py | 1 + tools/export_model.py | 4 +++- tools/export_serving_model.py | 3 ++- tools/face_eval.py | 3 ++- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/slim/distillation/distill.py b/slim/distillation/distill.py index 59e5593ec..f95fc264e 100644 --- a/slim/distillation/distill.py +++ b/slim/distillation/distill.py @@ -32,7 +32,7 @@ from ppdet.data.reader import create_reader from ppdet.utils.eval_utils import parse_fetches, eval_results, eval_run from ppdet.utils.stats import TrainingStats from ppdet.utils.cli import ArgsParser -from ppdet.utils.check import check_gpu, check_config +from ppdet.utils.check import check_gpu, check_version, check_config import ppdet.utils.checkpoint as checkpoint import logging @@ -134,6 +134,7 @@ def main(): check_config(cfg) # check if set use_gpu=True in paddlepaddle cpu version check_gpu(cfg.use_gpu) + check_version() main_arch = cfg.architecture diff --git a/slim/extensions/distill_pruned_model/distill_pruned_model.py b/slim/extensions/distill_pruned_model/distill_pruned_model.py index 3302f278c..71059202c 100644 --- a/slim/extensions/distill_pruned_model/distill_pruned_model.py +++ b/slim/extensions/distill_pruned_model/distill_pruned_model.py @@ -35,7 +35,7 @@ from ppdet.data.reader import create_reader from ppdet.utils.eval_utils import parse_fetches, eval_results, eval_run from ppdet.utils.stats import TrainingStats from ppdet.utils.cli import ArgsParser -from ppdet.utils.check import check_gpu, check_config +from ppdet.utils.check import check_gpu, check_version, check_config import ppdet.utils.checkpoint as checkpoint import logging @@ -123,6 +123,7 @@ def main(): check_config(cfg) # check if set use_gpu=True in paddlepaddle cpu version check_gpu(cfg.use_gpu) + check_version() main_arch = cfg.architecture diff --git a/slim/prune/export_model.py b/slim/prune/export_model.py index 808af9f3b..bc07c637d 100644 --- a/slim/prune/export_model.py +++ b/slim/prune/export_model.py @@ -27,7 +27,7 @@ from paddle import fluid from ppdet.core.workspace import load_config, merge_config, create from ppdet.utils.cli import ArgsParser import ppdet.utils.checkpoint as checkpoint -from ppdet.utils.check import check_config +from ppdet.utils.check import check_config, check_version from paddleslim.prune import Pruner from paddleslim.analysis import flops @@ -82,6 +82,7 @@ def main(): cfg = load_config(FLAGS.config) merge_config(FLAGS.opt) check_config(cfg) + check_version() main_arch = cfg.architecture diff --git a/slim/quantization/export_model.py b/slim/quantization/export_model.py index ab219fa3c..0a9950f59 100644 --- a/slim/quantization/export_model.py +++ b/slim/quantization/export_model.py @@ -27,7 +27,7 @@ from paddle import fluid from ppdet.core.workspace import load_config, merge_config, create from ppdet.utils.cli import ArgsParser import ppdet.utils.checkpoint as checkpoint -from ppdet.utils.check import check_config +from ppdet.utils.check import check_config, check_version from tools.export_model import prune_feed_vars import logging @@ -57,6 +57,7 @@ def main(): cfg = load_config(FLAGS.config) merge_config(FLAGS.opt) check_config(cfg) + check_version() main_arch = cfg.architecture diff --git a/slim/sensitive/sensitive.py b/slim/sensitive/sensitive.py index d57699ad3..23581fead 100644 --- a/slim/sensitive/sensitive.py +++ b/slim/sensitive/sensitive.py @@ -53,6 +53,7 @@ def main(): cfg = load_config(FLAGS.config) merge_config(FLAGS.opt) check_config(cfg) + check_version() main_arch = cfg.architecture diff --git a/tools/export_model.py b/tools/export_model.py index 8cadb912d..2cdf9c58d 100644 --- a/tools/export_model.py +++ b/tools/export_model.py @@ -28,7 +28,7 @@ from paddle import fluid from ppdet.core.workspace import load_config, merge_config, create from ppdet.utils.cli import ArgsParser import ppdet.utils.checkpoint as checkpoint -from ppdet.utils.check import check_config +from ppdet.utils.check import check_config, check_version import yaml import logging from collections import OrderedDict @@ -176,6 +176,8 @@ def main(): merge_config(FLAGS.opt) check_config(cfg) + check_version() + main_arch = cfg.architecture # Use CPU for exporting inference model instead of GPU diff --git a/tools/export_serving_model.py b/tools/export_serving_model.py index 725f0fe44..112acd552 100644 --- a/tools/export_serving_model.py +++ b/tools/export_serving_model.py @@ -22,7 +22,7 @@ from paddle import fluid from ppdet.core.workspace import load_config, merge_config, create from ppdet.utils.cli import ArgsParser -from ppdet.utils.check import check_config +from ppdet.utils.check import check_config, check_version import ppdet.utils.checkpoint as checkpoint import yaml import logging @@ -58,6 +58,7 @@ def main(): cfg = load_config(FLAGS.config) merge_config(FLAGS.opt) check_config(cfg) + check_version() main_arch = cfg.architecture diff --git a/tools/face_eval.py b/tools/face_eval.py index 41545760a..a32eb6a57 100644 --- a/tools/face_eval.py +++ b/tools/face_eval.py @@ -30,7 +30,7 @@ from collections import OrderedDict import ppdet.utils.checkpoint as checkpoint from ppdet.utils.cli import ArgsParser -from ppdet.utils.check import check_gpu, check_config +from ppdet.utils.check import check_gpu, check_version, check_config from ppdet.utils.widerface_eval_utils import get_shrink, bbox_vote, \ save_widerface_bboxes, save_fddb_bboxes, to_chw_bgr from ppdet.core.workspace import load_config, merge_config, create @@ -219,6 +219,7 @@ def main(): check_config(cfg) # check if set use_gpu=True in paddlepaddle cpu version check_gpu(cfg.use_gpu) + check_version() main_arch = cfg.architecture -- GitLab