from typing import Dict
from typing import Any
from pathlib import Path
import yaml
import json


def load_model_config(model_config_path: str) -> Dict[str, Any]:
    """Loads model config, either from yaml or json format."""
    config_path = Path(model_config_path)
    if config_path.suffix == ".yaml":
        return yaml.safe_load(config_path.open())
    elif config_path.suffix == ".json":
        return json.load(config_path.open())
    else:
        raise ValueError(f"Unsupported config file type {model_config_path}")