import torch


def adapt_config_to_machine(configs: dict) -> dict:
    """Adapt config to that model can be run on machine.

    Args:
        configs (dict): Dictionary of config dictionaries

    Returns:
        dict: Dictionary of config dictionaries
    """
    # adapt device
    configs["trainer_config"]["device"] = torch.device(
        "cuda"
        if configs["trainer_config"]["device"] == "cuda" and torch.cuda.is_available()
        else "cpu"
    )
    configs["dataset_config"]["cuda"] = (
        True
        if torch.cuda.is_available() and configs["dataset_config"]["cuda"] is True
        else False
    )
    return configs