Upload catalog.py with huggingface_hub
Browse files- catalog.py +5 -2
catalog.py
CHANGED
@@ -6,7 +6,7 @@ import json
|
|
6 |
from .artifact import Artifact, Artifactory
|
7 |
|
8 |
|
9 |
-
COLLECTION_SEPARATOR = '
|
10 |
PATHS_SEP = ':'
|
11 |
|
12 |
|
@@ -28,7 +28,10 @@ class LocalCatalog(Catalog):
|
|
28 |
location: str = default_catalog_path
|
29 |
|
30 |
def path(self, artifact_identifier: str):
|
31 |
-
|
|
|
|
|
|
|
32 |
|
33 |
def load(self, artifact_identifier: str):
|
34 |
assert artifact_identifier in self, "Artifact with name {} does not exist".format(artifact_identifier)
|
|
|
6 |
from .artifact import Artifact, Artifactory
|
7 |
|
8 |
|
9 |
+
COLLECTION_SEPARATOR = '.'
|
10 |
PATHS_SEP = ':'
|
11 |
|
12 |
|
|
|
28 |
location: str = default_catalog_path
|
29 |
|
30 |
def path(self, artifact_identifier: str):
|
31 |
+
assert artifact_identifier.strip(), 'artifact_identifier should not be an empty string.'
|
32 |
+
parts = artifact_identifier.split(COLLECTION_SEPARATOR)
|
33 |
+
parts[-1] = parts[-1] + ".json"
|
34 |
+
return os.path.join(self.location, *parts)
|
35 |
|
36 |
def load(self, artifact_identifier: str):
|
37 |
assert artifact_identifier in self, "Artifact with name {} does not exist".format(artifact_identifier)
|