From e3ca763dee594fd9317c510036c959e3b7f8ba67 Mon Sep 17 00:00:00 2001 From: WuHaobo Date: Mon, 13 Apr 2020 19:12:50 +0800 Subject: [PATCH] polish download pretrain --- {ppcls/modeling => configs}/pretrained.list | 0 ppcls/modeling/utils.py | 9 --------- ppcls/utils/check.py | 1 - ppcls/utils/model_zoo.py | 4 ++-- 4 files changed, 2 insertions(+), 12 deletions(-) rename {ppcls/modeling => configs}/pretrained.list (100%) diff --git a/ppcls/modeling/pretrained.list b/configs/pretrained.list similarity index 100% rename from ppcls/modeling/pretrained.list rename to configs/pretrained.list diff --git a/ppcls/modeling/utils.py b/ppcls/modeling/utils.py index 3867a6ed..acc4d194 100644 --- a/ppcls/modeling/utils.py +++ b/ppcls/modeling/utils.py @@ -16,8 +16,6 @@ import architectures import types from difflib import SequenceMatcher -from ppcls.utils.config import get_config - def get_architectures(): """ @@ -30,13 +28,6 @@ def get_architectures(): return names -def get_pretrained(): - """ - get all of model pretrained - """ - return get_config('./pretrained.list') - - def similar_architectures(name='', names=[], thresh=0.1, topk=10): """ inferred similar architectures diff --git a/ppcls/utils/check.py b/ppcls/utils/check.py index 3e286447..627e3953 100644 --- a/ppcls/utils/check.py +++ b/ppcls/utils/check.py @@ -20,7 +20,6 @@ import sys import paddle.fluid as fluid -from ppcls.modeling import get_architectures from ppcls.modeling import similar_architectures from ppcls.utils import logger diff --git a/ppcls/utils/model_zoo.py b/ppcls/utils/model_zoo.py index bdf1b8dc..130febf9 100644 --- a/ppcls/utils/model_zoo.py +++ b/ppcls/utils/model_zoo.py @@ -23,9 +23,9 @@ import tarfile import tqdm import zipfile -from ppcls.modeling import get_pretrained from ppcls.modeling import similar_architectures from ppcls.utils.check import check_architecture +from ppcls.utils.config import get_config from ppcls.utils import logger __all__ = ['get'] @@ -172,7 +172,7 @@ def _decompress(fname): def _check_pretrained_name(architecture): assert isinstance(architecture, str), \ ("the type of architecture({}) should be str". format(architecture)) - similar_names = similar_architectures(architecture, get_pretrained()) + similar_names = similar_architectures(architecture, get_config('../../../configs/pretrained.list')) model_list = ', '.join(similar_names) err = "{} is not exist! Maybe you want: [{}]" \ "".format(architecture, model_list) -- GitLab