From 31b84b3b83aab70dc7a503a00961522c24316c2c Mon Sep 17 00:00:00 2001 From: "mulin.lyh" Date: Mon, 4 Jul 2022 20:12:31 +0800 Subject: [PATCH] [to #43019862]feat: remove gitlab address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去掉gitlab地址配置 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9256404 * remove gitlab address --- modelscope/hub/api.py | 5 ++--- modelscope/hub/constants.py | 1 - modelscope/hub/repository.py | 4 ++-- modelscope/hub/utils/utils.py | 6 ------ 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/modelscope/hub/api.py b/modelscope/hub/api.py index 45e39133..6aeedc02 100644 --- a/modelscope/hub/api.py +++ b/modelscope/hub/api.py @@ -15,8 +15,7 @@ from ..utils.constant import DownloadMode from .constants import MODELSCOPE_URL_SCHEME from .errors import (InvalidParameter, NotExistError, datahub_raise_on_error, is_ok, raise_on_error) -from .utils.utils import (get_endpoint, get_gitlab_domain, - model_id_to_group_owner_name) +from .utils.utils import get_endpoint, model_id_to_group_owner_name logger = get_logger() @@ -109,7 +108,7 @@ class HubApi: cookies=cookies) r.raise_for_status() raise_on_error(r.json()) - model_repo_url = f'{MODELSCOPE_URL_SCHEME}{get_gitlab_domain()}/{model_id}' + model_repo_url = f'{get_endpoint()}/{model_id}' return model_repo_url def delete_model(self, model_id): diff --git a/modelscope/hub/constants.py b/modelscope/hub/constants.py index 91c08786..bf11b59d 100644 --- a/modelscope/hub/constants.py +++ b/modelscope/hub/constants.py @@ -1,7 +1,6 @@ MODELSCOPE_URL_SCHEME = 'http://' DEFAULT_MODELSCOPE_IP = '47.94.223.21' DEFAULT_MODELSCOPE_DOMAIN = DEFAULT_MODELSCOPE_IP + ':31090' -DEFAULT_MODELSCOPE_GITLAB_DOMAIN = '101.201.119.157:31102' DEFAULT_MODELSCOPE_DATA_ENDPOINT = MODELSCOPE_URL_SCHEME + DEFAULT_MODELSCOPE_IP + ':31752' DEFAULT_MODELSCOPE_GROUP = 'damo' diff --git a/modelscope/hub/repository.py b/modelscope/hub/repository.py index 2cf05adb..b3ffbb22 100644 --- a/modelscope/hub/repository.py +++ b/modelscope/hub/repository.py @@ -6,7 +6,7 @@ from modelscope.utils.logger import get_logger from .api import ModelScopeConfig from .constants import MODELSCOPE_URL_SCHEME from .git import GitCommandWrapper -from .utils.utils import get_gitlab_domain +from .utils.utils import get_endpoint logger = get_logger() @@ -65,7 +65,7 @@ class Repository: git_wrapper.git_lfs_install(self.model_dir) # init repo lfs def _get_model_id_url(self, model_id): - url = f'{MODELSCOPE_URL_SCHEME}{get_gitlab_domain()}/{model_id}.git' + url = f'{get_endpoint()}/{model_id}.git' return url def _get_remote_url(self): diff --git a/modelscope/hub/utils/utils.py b/modelscope/hub/utils/utils.py index d0704de8..0c5c166f 100644 --- a/modelscope/hub/utils/utils.py +++ b/modelscope/hub/utils/utils.py @@ -1,7 +1,6 @@ import os from modelscope.hub.constants import (DEFAULT_MODELSCOPE_DOMAIN, - DEFAULT_MODELSCOPE_GITLAB_DOMAIN, DEFAULT_MODELSCOPE_GROUP, MODEL_ID_SEPARATOR, MODELSCOPE_URL_SCHEME) @@ -32,8 +31,3 @@ def get_endpoint(): modelscope_domain = os.getenv('MODELSCOPE_DOMAIN', DEFAULT_MODELSCOPE_DOMAIN) return MODELSCOPE_URL_SCHEME + modelscope_domain - - -def get_gitlab_domain(): - return os.getenv('MODELSCOPE_GITLAB_DOMAIN', - DEFAULT_MODELSCOPE_GITLAB_DOMAIN)