From fe2bcde41c2b8a5a0a0ed6030c248d9c45779ff8 Mon Sep 17 00:00:00 2001 From: Yingda Chen Date: Sat, 8 Feb 2025 11:32:42 +0800 Subject: [PATCH] change log msg --- modelscope/hub/snapshot_download.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modelscope/hub/snapshot_download.py b/modelscope/hub/snapshot_download.py index 2c79050c..75bcb991 100644 --- a/modelscope/hub/snapshot_download.py +++ b/modelscope/hub/snapshot_download.py @@ -246,9 +246,13 @@ def _snapshot_download( if cookies is None: cookies = ModelScopeConfig.get_cookies() if repo_type == REPO_TYPE_MODEL: - directory = os.path.abspath( - local_dir) if local_dir is not None else os.path.join( - system_cache, 'models', *repo_id.split('/')) + if local_dir: + directory = os.path.abspath(local_dir) + elif cache_dir: + directory = os.path.join(system_cache, *repo_id.split('/')) + else: + directory = os.path.join(system_cache, 'models', + *repo_id.split('/')) print(f'Downloading Model to directory: {directory}') revision_detail = _api.get_valid_revision_detail( repo_id, revision=revision, cookies=cookies) @@ -307,9 +311,13 @@ def _snapshot_download( ) elif repo_type == REPO_TYPE_DATASET: - directory = os.path.abspath( - local_dir) if local_dir else os.path.join( - system_cache, 'datasets', *repo_id.split('/')) + if local_dir: + directory = os.path.abspath(local_dir) + elif cache_dir: + directory = os.path.join(system_cache, *repo_id.split('/')) + else: + directory = os.path.join(system_cache, 'datasets', + *repo_id.split('/')) print(f'Downloading Dataset to directory: {directory}') group_or_owner, name = model_id_to_group_owner_name(repo_id) revision_detail = revision or DEFAULT_DATASET_REVISION