Skip to content

create_model_string

anomaly_match.utils.create_model_string

Model string generation for checkpoint naming.

create_model_string(cfg)

Creates a string from the arguments.

Parameters:

Name Type Description Default
cfg DotMap

config dictionary/dotmap

required

Returns:

Type Description
str

string of the arguments

Source code in anomaly_match/utils/create_model_string.py
def create_model_string(cfg: DotMap) -> str:
    """Creates a string from the arguments.

    Args:
        cfg: config dictionary/dotmap

    Returns:
        string of the arguments
    """
    # fmt: off
    dir_name = (
        "model"
        + "_" + str(cfg.name)
        # Add date and time to the directory name
        + "_" + datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    )
    # fmt: on
    return dir_name