Upload register.py with huggingface_hub
Browse files2 unmodified lines345667891091011127 unmodified lines202122242324252627282930313233343536373839394041422 unmodified linesimport os
from .artifact import Artifact, Artifactoriesfrom .catalog import LocalCatalog, GithubCatalog, PATHS_SEPfrom .catalog import PATHS_SEP, GithubCatalog, LocalCatalogfrom .utils import Singleton
UNITXT_ARTIFACTORIES_ENV_VAR = 'UNITXT_ARTIFACTORIES'UNITXT_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