From 06108d105ab42816fb958487e1adc3e5dc780c35 Mon Sep 17 00:00:00 2001 From: Yingda Chen Date: Sat, 2 Nov 2024 08:02:50 +0800 Subject: [PATCH] add log for download location (#1061) Co-authored-by: Yingda Chen --- modelscope/hub/snapshot_download.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modelscope/hub/snapshot_download.py b/modelscope/hub/snapshot_download.py index a4eda17b..1fe94b82 100644 --- a/modelscope/hub/snapshot_download.py +++ b/modelscope/hub/snapshot_download.py @@ -193,7 +193,9 @@ def _snapshot_download( temporary_cache_dir, cache = create_temporary_directory_and_cache( repo_id, local_dir=local_dir, cache_dir=cache_dir, repo_type=repo_type) - + system_cache = cache_dir if cache_dir is not None else os.getenv( + 'MODELSCOPE_CACHE', + Path.home().joinpath('.cache', 'modelscope')) if local_files_only: if len(cache.cached_files) == 0: raise ValueError( @@ -217,6 +219,8 @@ def _snapshot_download( if cookies is None: cookies = ModelScopeConfig.get_cookies() repo_files = [] + directory = os.path.join(system_cache, 'hub', repo_id) + print(f'Downloading Model to directory: {directory}') if repo_type == REPO_TYPE_MODEL: revision_detail = _api.get_valid_revision_detail( repo_id, revision=revision, cookies=cookies) @@ -257,6 +261,8 @@ def _snapshot_download( allow_patterns=allow_patterns) elif repo_type == REPO_TYPE_DATASET: + directory = os.path.join(system_cache, 'datasets', repo_id) + print(f'Downloading Dataset to directory: {directory}') group_or_owner, name = model_id_to_group_owner_name(repo_id) if not revision: revision = DEFAULT_DATASET_REVISION