From f9cf8bf12149418b6ed8b091ba91f71e8ee0ecd9 Mon Sep 17 00:00:00 2001 From: "Xingjun.Wang" Date: Thu, 19 Jun 2025 10:36:44 +0800 Subject: [PATCH 1/4] fix some bugs in HubApi (#1369) --- modelscope/hub/api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modelscope/hub/api.py b/modelscope/hub/api.py index 8c3570c5..a903c648 100644 --- a/modelscope/hub/api.py +++ b/modelscope/hub/api.py @@ -32,6 +32,7 @@ from modelscope.hub.constants import (API_HTTP_CLIENT_MAX_RETRIES, API_RESPONSE_FIELD_DATA, API_RESPONSE_FIELD_EMAIL, API_RESPONSE_FIELD_GIT_ACCESS_TOKEN, + API_RESPONSE_FIELD_MESSAGE, API_RESPONSE_FIELD_USERNAME, DEFAULT_CREDENTIALS_PATH, DEFAULT_MAX_WORKERS, @@ -372,6 +373,7 @@ class HubApi: set in HubApi class (self.endpoint) re_raise(`bool`): raise exception when error + token (`str`, *optional*): access token to use for checking existence. Returns: True if the repository exists, False otherwise. """ @@ -1426,6 +1428,7 @@ class HubApi: endpoint (Optional[str]): The endpoint to use. In the format of `https://www.modelscope.cn` or 'https://www.modelscope.ai' exist_ok (Optional[bool]): If the repo exists, whether to return the repo url directly. + create_default_config (Optional[bool]): If True, create a default configuration file in the model repo. **kwargs: The additional arguments. Returns: @@ -1437,15 +1440,15 @@ class HubApi: if not endpoint: endpoint = self.endpoint - repo_exists: bool = self.repo_exists(repo_id, repo_type=repo_type, endpoint=endpoint) + self.login(access_token=token, endpoint=endpoint) + + repo_exists: bool = self.repo_exists(repo_id, repo_type=repo_type, endpoint=endpoint, token=token) if repo_exists: if exist_ok: return f'{endpoint}/{repo_type}s/{repo_id}' else: raise ValueError(f'Repo {repo_id} already exists!') - self.login(access_token=token, endpoint=endpoint) - repo_id_list = repo_id.split('/') if len(repo_id_list) != 2: raise ValueError('Invalid repo id, should be in the format of `owner_name/repo_name`') From d6a11d352a8864f9a867464fb68cdf9e25f22a65 Mon Sep 17 00:00:00 2001 From: "Xingjun.Wang" Date: Thu, 19 Jun 2025 15:49:31 +0800 Subject: [PATCH 2/4] Set the maximum value of MODELSCOPE_DOWNLOAD_PARALLELS to 16 (#1371) --- modelscope/hub/file_download.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modelscope/hub/file_download.py b/modelscope/hub/file_download.py index 1090fceb..c323844e 100644 --- a/modelscope/hub/file_download.py +++ b/modelscope/hub/file_download.py @@ -462,7 +462,7 @@ def parallel_download(url: str, if end + 1 < file_size: tasks.append((file_path, progress, end + 1, file_size - 1, url, file_name, cookies, headers)) - parallels = MODELSCOPE_DOWNLOAD_PARALLELS if MODELSCOPE_DOWNLOAD_PARALLELS <= 4 else 4 + parallels = min(MODELSCOPE_DOWNLOAD_PARALLELS, 16) # download every part with ThreadPoolExecutor( max_workers=parallels, From a1e5cceeca98984a42f86cfc15bf84e9b7c30dc3 Mon Sep 17 00:00:00 2001 From: "Xingjun.Wang" Date: Thu, 19 Jun 2025 17:06:29 +0800 Subject: [PATCH 3/4] Set size_threshold_to_enforce_lfs to 1MB (#1375) * Set the maximum value of MODELSCOPE_DOWNLOAD_PARALLELS to 16 * set size_threshold_to_enforce_lfs to 1MB --- modelscope/hub/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modelscope/hub/api.py b/modelscope/hub/api.py index a903c648..5c8e855e 100644 --- a/modelscope/hub/api.py +++ b/modelscope/hub/api.py @@ -2237,7 +2237,7 @@ class UploadingCheck: max_file_count: int = 100_000, max_file_count_in_dir: int = 50_000, max_file_size: int = 50 * 1024 ** 3, - size_threshold_to_enforce_lfs: int = 5 * 1024 * 1024, + size_threshold_to_enforce_lfs: int = 1 * 1024 * 1024, normal_file_size_total_limit: int = 500 * 1024 * 1024, ): self.max_file_count = max_file_count From ea8d54a82d0c494501fff64588498e8b05f4f334 Mon Sep 17 00:00:00 2001 From: suluyan Date: Fri, 20 Jun 2025 11:21:17 +0800 Subject: [PATCH 4/4] bump version 1.27.1 --- modelscope/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modelscope/version.py b/modelscope/version.py index b8e65a1d..92d737c2 100644 --- a/modelscope/version.py +++ b/modelscope/version.py @@ -1,5 +1,5 @@ # Make sure to modify __release_datetime__ to release time when making official release. -__version__ = '1.27.0' +__version__ = '1.27.1' # default release datetime for branches under active development is set # to be a time far-far-away-into-the-future __release_datetime__ = '2025-06-12 23:59:59'