def log_params_from_dict()

in phi3/src_train/train_mlflow.py [0:0]


def log_params_from_dict(config, mlflow_client, parent_key=''):
    """
    Given a dictionary of parameters, logs non-dictionary values to the specified mlflow client.
    Ignores nested dictionaries.

    Args:
        config (dict): The dictionary of parameters to log.
        mlflow_client: The mlflow client to use for logging.
        parent_key (str): Used to prefix keys (for nested logging).
    """
    for key, value in config.items():
        if isinstance(value, dict):
            continue
        elif isinstance(value, list):
            full_key = f"{parent_key}.{key}" if parent_key else key
            mlflow_client.log_param(full_key, ','.join(map(str, value)))
        else:
            full_key = f"{parent_key}.{key}" if parent_key else key
            mlflow_client.log_param(full_key, value)