Merge branch 'release/1.27' into build_swift_image

This commit is contained in:
Jintao Huang
2025-07-02 11:02:55 +08:00
3 changed files with 9 additions and 6 deletions

View File

@@ -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`')
@@ -2234,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

View File

@@ -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,

View File

@@ -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'