diff --git a/deploy/utils/predictor.py b/deploy/utils/predictor.py index 04f9eab7a8..f99b407b85 100644 --- a/deploy/utils/predictor.py +++ b/deploy/utils/predictor.py @@ -55,11 +55,9 @@ def create_paddle_predictor(self, args, inference_model_dir=None): ) is False, "int8 mode is not supported for fp32 model inference, please set use_int8 as False during inference." # NOTE: paddle support to PIR mode after v2.6.0 - pd_version = 0 - for v in paddle.__version__.split(".")[:3]: - pd_version = 10 * pd_version + eval(v) - - if pd_version == 0 or pd_version >= 260: + major_v, minor_v, _ = paddle.__version__.split(".")[:3] + major_v, minor_v = int(major_v), int(minor_v) + if (major_v == 0 and minor_v == 0) or (major_v >= 3): config = Config(inference_model_dir, model_prefix) else: model_file = os.path.join(inference_model_dir, f"{model_prefix}.pdmodel") diff --git a/paddleclas.py b/paddleclas.py index 27e0b5c708..9255819acc 100644 --- a/paddleclas.py +++ b/paddleclas.py @@ -46,7 +46,7 @@ __all__ = ["PaddleClas"] -BASE_DIR = os.path.expanduser("~/.paddleclas/") +BASE_DIR = os.path.expanduser(os.path.join("~", ".paddleclas")) BASE_INFERENCE_MODEL_DIR = os.path.join(BASE_DIR, "inference_model") BASE_IMAGES_DIR = os.path.join(BASE_DIR, "images") IMN_MODEL_BASE_DOWNLOAD_URL = "https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/{}_infer.tar"