Spaces:
Sleeping
Sleeping
Change two instances of `if ...is_dir` to use ()
Browse filesThis should fix a bug where the HuggingFace storage library tries to upload a folder that's actually a file.
huggingface_overlay/cloud_pipelines_backend/storage_providers/huggingface_repo_storage.py
CHANGED
|
@@ -89,7 +89,7 @@ class HuggingFaceRepoStorageProvider(interfaces.StorageProvider):
|
|
| 89 |
|
| 90 |
def upload(self, source_path: str, destination_uri: HuggingFaceRepoUri):
|
| 91 |
_LOGGER.debug(f"Uploading from {source_path} to {destination_uri}")
|
| 92 |
-
if pathlib.Path(source_path).is_dir:
|
| 93 |
self._client.upload_folder(
|
| 94 |
repo_type=destination_uri.repo_type,
|
| 95 |
repo_id=destination_uri.repo_id,
|
|
@@ -119,7 +119,7 @@ class HuggingFaceRepoStorageProvider(interfaces.StorageProvider):
|
|
| 119 |
)
|
| 120 |
import shutil
|
| 121 |
|
| 122 |
-
if cache_data_path.is_dir:
|
| 123 |
shutil.copytree(cache_data_path, destination_path, dirs_exist_ok=True)
|
| 124 |
else:
|
| 125 |
pathlib.Path(destination_path).parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 89 |
|
| 90 |
def upload(self, source_path: str, destination_uri: HuggingFaceRepoUri):
|
| 91 |
_LOGGER.debug(f"Uploading from {source_path} to {destination_uri}")
|
| 92 |
+
if pathlib.Path(source_path).is_dir():
|
| 93 |
self._client.upload_folder(
|
| 94 |
repo_type=destination_uri.repo_type,
|
| 95 |
repo_id=destination_uri.repo_id,
|
|
|
|
| 119 |
)
|
| 120 |
import shutil
|
| 121 |
|
| 122 |
+
if cache_data_path.is_dir():
|
| 123 |
shutil.copytree(cache_data_path, destination_path, dirs_exist_ok=True)
|
| 124 |
else:
|
| 125 |
pathlib.Path(destination_path).parent.mkdir(parents=True, exist_ok=True)
|