Elron commited on
Commit
b113398
1 Parent(s): df49807

Upload register.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. register.py +13 -3
register.py CHANGED
@@ -21,12 +21,22 @@ non_registered_files = [
21
  ]
22
 
23
 
 
 
 
 
 
 
 
 
 
24
  def _register_all_catalogs():
25
- Artifactories().register_atrifactory(LocalCatalog())
 
26
  if UNITXT_ARTIFACTORIES_ENV_VAR in os.environ:
27
  for path in os.environ[UNITXT_ARTIFACTORIES_ENV_VAR].split(PATHS_SEP):
28
- Artifactories().register_atrifactory(LocalCatalog(location=path))
29
- Artifactories().register_atrifactory(GithubCatalog())
30
 
31
  def _register_all_artifacts():
32
  dir = os.path.dirname(__file__)
 
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__)