Upload register.py with huggingface_hub
Browse files2 unmodified lines3456789101112137 unmodified lines212223242526272829303132333435363738394041422 unmodified linesimport osfrom .artifact import Artifact, Artifactoriesfrom .catalog import LocalCatalog, GithubCatalog, PATHS_SEPfrom .utils import SingletonUNITXT_ARTIFACTORIES_ENV_VAR = 'UNITXT_ARTIFACTORIES'# Usagenon_registered_files = [7 unmodified lines]def _register_catalog(catalog: LocalCatalog):Artifactories().register_atrifactory(catalog)def register_local_catalog(catalog_path: str):assert os.path.exists(catalog_path), f"Catalog path {catalog_path} does not exist."assert os.path.isdir(catalog_path), f"Catalog path {catalog_path} is not a directory."_register_catalog(LocalCatalog(location=catalog_path))def _register_all_catalogs():_register_catalog(GithubCatalog())_register_catalog(LocalCatalog())if UNITXT_ARTIFACTORIES_ENV_VAR in os.environ:for path in os.environ[UNITXT_ARTIFACTORIES_ENV_VAR].split(PATHS_SEP):_register_catalog(LocalCatalog(location=path))def _register_all_artifacts():dir = os.path.dirname(__file__)2 unmodified lines34567891011127 unmodified lines20212223242526272829303132333435363738394041422 unmodified linesimport osfrom .artifact import Artifact, Artifactoriesfrom .catalog import PATHS_SEP, GithubCatalog, LocalCatalogfrom .utils import SingletonUNITXT_ARTIFACTORIES_ENV_VAR = "UNITXT_ARTIFACTORIES"# Usagenon_registered_files = [7 unmodified lines]def _register_catalog(catalog: LocalCatalog):Artifactories().register_atrifactory(catalog)def register_local_catalog(catalog_path: str):assert os.path.exists(catalog_path), f"Catalog path {catalog_path} does not exist."assert os.path.isdir(catalog_path), f"Catalog path {catalog_path} is not a directory."_register_catalog(LocalCatalog(location=catalog_path))def _register_all_catalogs():_register_catalog(GithubCatalog())_register_catalog(LocalCatalog())if UNITXT_ARTIFACTORIES_ENV_VAR in os.environ:for path in os.environ[UNITXT_ARTIFACTORIES_ENV_VAR].split(PATHS_SEP):_register_catalog(LocalCatalog(location=path))def _register_all_artifacts():dir = os.path.dirname(__file__)
register.py+5-5