Upload register.py with huggingface_hub
Browse files- register.py +5 -5
register.py
CHANGED
|
@@ -3,11 +3,10 @@ import inspect
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
from .artifact import Artifact, Artifactories
|
| 6 |
-
from .catalog import
|
| 7 |
from .utils import Singleton
|
| 8 |
|
| 9 |
-
|
| 10 |
-
UNITXT_ARTIFACTORIES_ENV_VAR = 'UNITXT_ARTIFACTORIES'
|
| 11 |
|
| 12 |
# Usage
|
| 13 |
non_registered_files = [
|
|
@@ -21,22 +20,23 @@ non_registered_files = [
|
|
| 21 |
]
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
def _register_catalog(catalog: LocalCatalog):
|
| 26 |
Artifactories().register_atrifactory(catalog)
|
| 27 |
|
|
|
|
| 28 |
def register_local_catalog(catalog_path: str):
|
| 29 |
assert os.path.exists(catalog_path), f"Catalog path {catalog_path} does not exist."
|
| 30 |
assert os.path.isdir(catalog_path), f"Catalog path {catalog_path} is not a directory."
|
| 31 |
_register_catalog(LocalCatalog(location=catalog_path))
|
| 32 |
|
|
|
|
| 33 |
def _register_all_catalogs():
|
| 34 |
_register_catalog(GithubCatalog())
|
| 35 |
_register_catalog(LocalCatalog())
|
| 36 |
if UNITXT_ARTIFACTORIES_ENV_VAR in os.environ:
|
| 37 |
for path in os.environ[UNITXT_ARTIFACTORIES_ENV_VAR].split(PATHS_SEP):
|
| 38 |
_register_catalog(LocalCatalog(location=path))
|
| 39 |
-
|
| 40 |
|
| 41 |
def _register_all_artifacts():
|
| 42 |
dir = os.path.dirname(__file__)
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
from .artifact import Artifact, Artifactories
|
| 6 |
+
from .catalog import PATHS_SEP, GithubCatalog, LocalCatalog
|
| 7 |
from .utils import Singleton
|
| 8 |
|
| 9 |
+
UNITXT_ARTIFACTORIES_ENV_VAR = "UNITXT_ARTIFACTORIES"
|
|
|
|
| 10 |
|
| 11 |
# Usage
|
| 12 |
non_registered_files = [
|
|
|
|
| 20 |
]
|
| 21 |
|
| 22 |
|
|
|
|
| 23 |
def _register_catalog(catalog: LocalCatalog):
|
| 24 |
Artifactories().register_atrifactory(catalog)
|
| 25 |
|
| 26 |
+
|
| 27 |
def register_local_catalog(catalog_path: str):
|
| 28 |
assert os.path.exists(catalog_path), f"Catalog path {catalog_path} does not exist."
|
| 29 |
assert os.path.isdir(catalog_path), f"Catalog path {catalog_path} is not a directory."
|
| 30 |
_register_catalog(LocalCatalog(location=catalog_path))
|
| 31 |
|
| 32 |
+
|
| 33 |
def _register_all_catalogs():
|
| 34 |
_register_catalog(GithubCatalog())
|
| 35 |
_register_catalog(LocalCatalog())
|
| 36 |
if UNITXT_ARTIFACTORIES_ENV_VAR in os.environ:
|
| 37 |
for path in os.environ[UNITXT_ARTIFACTORIES_ENV_VAR].split(PATHS_SEP):
|
| 38 |
_register_catalog(LocalCatalog(location=path))
|
| 39 |
+
|
| 40 |
|
| 41 |
def _register_all_artifacts():
|
| 42 |
dir = os.path.dirname(__file__)
|