Update downloading progress (#1167)

* add MODELSCOPE_SHOW_PROGRESS_THRESHOLD

* lint

* update: MODELSCOPE_SHOW_INDIVIDUAL_PROGRESS_THRESHOLD
This commit is contained in:
Xingjun.Wang
2024-12-31 18:28:15 +08:00
committed by GitHub
parent 391c6cdec9
commit 9ee1ff8cee
2 changed files with 5 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ ONE_YEAR_SECONDS = 24 * 365 * 60 * 60
MODELSCOPE_REQUEST_ID = 'X-Request-ID'
TEMPORARY_FOLDER_NAME = '._____temp'
DEFAULT_MAX_WORKERS = min(8, os.cpu_count() + 4)
MODELSCOPE_SHOW_INDIVIDUAL_PROGRESS_THRESHOLD = int(
os.environ.get('MODELSCOPE_SHOW_INDIVIDUAL_PROGRESS_THRESHOLD', 50))
class Licenses(object):

View File

@@ -9,6 +9,7 @@ from pathlib import Path
from typing import Dict, List, Optional, Union
from modelscope.hub.api import HubApi, ModelScopeConfig
from modelscope.hub.constants import MODELSCOPE_SHOW_INDIVIDUAL_PROGRESS_THRESHOLD
from modelscope.hub.errors import InvalidParameter
from modelscope.hub.file_download import (create_temporary_directory_and_cache,
download_file, get_file_download_url)
@@ -486,7 +487,8 @@ def _download_file_lists(
cache,
headers,
cookies,
disable_tqdm=True,
disable_tqdm=len(filtered_repo_files) >
MODELSCOPE_SHOW_INDIVIDUAL_PROGRESS_THRESHOLD,
)
if len(filtered_repo_files) > 0: