INNER CODE UNIT · Python

read_config

allenai/dolma · python/dolma/cli/main.py:34

def read_config(path: Union[None, str]) -> Dict[str, Any]:
    """Read a configuration file if it exists"""
    if path is None:
        return {}

    if not exists(path):
        raise FileNotFoundError(f"Config file {path} does not exist")

    with smart_open.open(path, mode="rt") as f:
        return dict(safe_load(f))


def main(argv: Optional[List[str]] = None):
    """Main entry point for the CLI"""

    try:
        # attempting to set start method to spawn in case it is not set
        multiprocessing.set_start_method("spawn")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…