add log for download location (#1061)

Co-authored-by: Yingda Chen <yingda.chen@alibaba-inc.com>
This commit is contained in:
Yingda Chen
2024-11-02 08:02:50 +08:00
committed by GitHub
parent 250b72fce7
commit 06108d105a

View File

@@ -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