From e7b9b1ca24616bf5a104c1389c41449f84755890 Mon Sep 17 00:00:00 2001 From: "mulin.lyh" Date: Thu, 9 Mar 2023 01:03:26 +0800 Subject: [PATCH] [to #47783159]fix: simply snapshot_download log Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11908733 --- modelscope/hub/file_download.py | 6 +++--- modelscope/hub/snapshot_download.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modelscope/hub/file_download.py b/modelscope/hub/file_download.py index 23391073..7a731b79 100644 --- a/modelscope/hub/file_download.py +++ b/modelscope/hub/file_download.py @@ -121,7 +121,7 @@ def model_file_download( if model_file['Path'] == file_path: if cache.exists(model_file): - logger.info( + logger.debug( f'File {model_file["Name"]} already in cache, skip downloading!' ) return cache.get_file_by_info(model_file) @@ -209,7 +209,7 @@ def http_get_file( tempfile.NamedTemporaryFile, mode='wb', dir=local_dir, delete=False) get_headers = {} if headers is None else copy.deepcopy(headers) with temp_file_manager() as temp_file: - logger.info('downloading %s to %s', url, temp_file.name) + logger.debug('downloading %s to %s', url, temp_file.name) # retry sleep 0.5s, 1s, 2s, 4s retry = Retry( total=API_FILE_DOWNLOAD_RETRY_TIMES, @@ -248,7 +248,7 @@ def http_get_file( retry = retry.increment('GET', url, error=e) retry.sleep() - logger.info('storing %s in cache at %s', url, local_dir) + logger.debug('storing %s in cache at %s', url, local_dir) downloaded_length = os.path.getsize(temp_file.name) if total != downloaded_length: os.remove(temp_file.name) diff --git a/modelscope/hub/snapshot_download.py b/modelscope/hub/snapshot_download.py index 67492649..25a97975 100644 --- a/modelscope/hub/snapshot_download.py +++ b/modelscope/hub/snapshot_download.py @@ -122,7 +122,7 @@ def snapshot_download(model_id: str, # check model_file is exist in cache, if existed, skip download, otherwise download if cache.exists(model_file): file_name = os.path.basename(model_file['Name']) - logger.info( + logger.debug( f'File {file_name} already in cache, skip downloading!' ) continue