mirror of
https://github.com/modelscope/modelscope.git
synced 2026-05-18 05:05:00 +02:00
ok Merge branch 'master' of github.com:modelscope/modelscope into release/1.33
This commit is contained in:
@@ -2310,9 +2310,18 @@ class HubApi:
|
||||
|
||||
# Ignore .git .cache folders
|
||||
if ignore_patterns is None:
|
||||
ignore_patterns = DEFAULT_IGNORE_PATTERNS
|
||||
ignore_patterns = []
|
||||
elif isinstance(ignore_patterns, str):
|
||||
ignore_patterns = [ignore_patterns]
|
||||
ignore_patterns += DEFAULT_IGNORE_PATTERNS
|
||||
|
||||
# Cover the ignore patterns if both allow and ignore patterns are provided
|
||||
if allow_patterns is not None:
|
||||
if '**' in allow_patterns:
|
||||
ignore_patterns = []
|
||||
ignore_patterns = [
|
||||
p for p in ignore_patterns if p not in allow_patterns
|
||||
]
|
||||
|
||||
commit_message = (
|
||||
commit_message if commit_message is not None else f'Upload to {repo_id} on ModelScope hub'
|
||||
|
||||
@@ -19,6 +19,7 @@ from modelscope.utils.logger import get_logger
|
||||
from modelscope.utils.thread_utils import thread_executor
|
||||
from .api import HubApi, ModelScopeConfig
|
||||
from .callback import ProgressCallback
|
||||
from .constants import DEFAULT_MAX_WORKERS
|
||||
from .errors import InvalidParameter
|
||||
from .file_download import (create_temporary_directory_and_cache,
|
||||
download_file, get_file_download_url)
|
||||
@@ -42,7 +43,7 @@ def snapshot_download(
|
||||
local_dir: Optional[str] = None,
|
||||
allow_patterns: Optional[Union[List[str], str]] = None,
|
||||
ignore_patterns: Optional[Union[List[str], str]] = None,
|
||||
max_workers: int = 8,
|
||||
max_workers: Optional[int] = None,
|
||||
repo_id: str = None,
|
||||
repo_type: Optional[str] = REPO_TYPE_MODEL,
|
||||
enable_file_lock: Optional[bool] = None,
|
||||
@@ -112,6 +113,8 @@ def snapshot_download(
|
||||
f'Invalid repo type: {repo_type}, only support: {REPO_TYPE_SUPPORT}'
|
||||
)
|
||||
|
||||
max_workers = max_workers or DEFAULT_MAX_WORKERS
|
||||
|
||||
if revision is None:
|
||||
revision = DEFAULT_DATASET_REVISION if repo_type == REPO_TYPE_DATASET else DEFAULT_MODEL_REVISION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user