From b2cdb723df6afc29d44863ac8cc569e0a9e5c869 Mon Sep 17 00:00:00 2001 From: Yingda Chen Date: Fri, 10 Jan 2025 13:48:44 +0800 Subject: [PATCH] fix path contatenation to be windows compatabile (#1176) * fix path contatenation to be windows compatabile * support dataset too --------- Co-authored-by: Yingda Chen --- modelscope/hub/snapshot_download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modelscope/hub/snapshot_download.py b/modelscope/hub/snapshot_download.py index 4510280b..2f7f4790 100644 --- a/modelscope/hub/snapshot_download.py +++ b/modelscope/hub/snapshot_download.py @@ -233,7 +233,7 @@ def _snapshot_download( if repo_type == REPO_TYPE_MODEL: directory = os.path.abspath( local_dir) if local_dir is not None else os.path.join( - system_cache, repo_id) + system_cache, *repo_id.split('/')) print(f'Downloading Model to directory: {directory}') revision_detail = _api.get_valid_revision_detail( repo_id, revision=revision, cookies=cookies) @@ -294,7 +294,7 @@ 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) + 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)