comet-ml/comet-examples

Invalid Optimizer configuration given, please check the configuration keys error

jakubMitura14 opened this issue · 1 comments

I get error

Invalid Optimizer configuration given, please check the configuration keys error

when invoking line

opt = Optimizer(config)

with configuration as below

for the begining I treat all the hyperparameters as discrete - as seen above some are integers some floats some tuples, dictionaries, objects ... , as far as I understand I can put anything in discrete type am I wrong?

config = {
    # We pick the Bayes algorithm:
    "algorithm": "bayes",

    # Declare  hyperparameters in 
    "parameters": {
        "loss": {"type": "discrete", "values": [monai.losses.FocalLoss(include_background=False, to_onehot_y=True)]},
        "stridesAndChannels": {"type": "discrete", "values": [{
                                                            "strides":[(2, 2, 2), (1, 2, 2), (1, 2, 2), (1, 2, 2), (2, 2, 2)]
                                                            ,"channels":[32, 64, 128, 256, 512, 1024]
                                                            }]},
        "optimizer_class": {"type": "discrete", "values": [torch.optim.AdamW]},
        "num_res_units": {"type": "discrete", "values": [0]},
        "act": {"type": "discrete", "values": [(Act.PRELU, {"init": 0.2})]},#,(Act.LeakyReLU,{"negative_slope":0.1, "inplace":True} )
        "norm": {"type": "discrete", "values": [(Norm.INSTANCE, {})]},
        "dropout": {"type": "discrete", "values": [0.0]},
        "precision": {"type": "discrete", "values": [16]},
        "accumulate_grad_batches": {"type": "discrete", "values": [1]},
        "gradient_clip_val": {"type": "discrete", "values": [0.0]},
        "RandGaussianNoised_prob": {"type": "discrete", "values": [0.1]},
        "RandAdjustContrastd_prob": {"type": "discrete", "values": [0.1]},
        "RandGaussianSmoothd_prob": {"type": "discrete", "values": [0.1]},
        "RandRicianNoised_prob": {"type": "discrete", "values": [0.1]},
        "RandFlipd_prob": {"type": "discrete", "values": [0.1]},
        "RandAffined_prob": {"type": "discrete", "values": [0.1]},
        "RandCoarseDropoutd_prob": {"type": "discrete", "values": [0.1]},
        "is_whole_to_train": {"type": "discrete", "values": [True,False]},
        "dirs": {"type": "discrete", "values": [
                                                {
                                                "cache_dir":"/home/sliceruser/preprocess/monai_persistent_Dataset"
                                                ,"t2w_name":"t2w_med_spac"
                                                ,"adc_name":"registered_adc_med_spac"
                                                ,"hbv_name":"registered_hbv_med_spac"
                                                ,"label_name":"label_med_spac" 
                                                ,"metDataDir":"/home/sliceruser/data/metadata/processedMetaData_current.csv"
                                                }
                                                    ]},
    },

    # Declare what we will be optimizing, and how:
    "spec": {
    "metric": "loss",
        "objective": "minimize",
    },
}

ok I got it objects are not supported