def load_hparams_from_checkpoint_name(name):
    """
    Loads hparams from a checkpoint file name in the format (inside parenthesis are variables)
    (dsname)_k(k)_L(nlayers)_bs(batch_size)_(model_type)_(epoch_number).pkl
    """
    parts = name.split("_")
    return {
        "dataset_name" : parts[0],
        "k" : int(parts[1][1:]),
        "num_layers" : int(parts[2][1:]),
        "batch_size" : int(parts[3][2:]),
        "model_type" : parts[4],
        "epoch" : int(parts[5].split(".")[0])
    }