MONAILabel icon indicating copy to clipboard operation
MONAILabel copied to clipboard

Simplify adding static parameters and metric to MLFlow

Open AHarouni opened this issue 2 years ago • 3 comments

MLflow feature tracking is great feature that allows user to run multiple experiments and see why.

To do so we must be able to log all metric and parameters used in the experiment. It is not clear/simple to add any static variable to the experiment. For example I have added a lot of parameters which I can control from slicer UI. However, I don't see an easy way to add them to mlflow.

Also I recently added a running val metric val_los how can I add that to the tracked variables

Describe the solution you'd like It would be great if : 1- is there is a simple method to override and add new static global vars as form the config. 2- there is a simple method to override to add new running metrices 2- we can add all existing parameters as number of gpus used, datacaching used, loaders, time it took to run, etc

AHarouni avatar Apr 08 '23 01:04 AHarouni

Please raise the issue on monai git repo.. the handler is from there

SachidanandAlle avatar Apr 08 '23 01:04 SachidanandAlle

@SachidanandAlle Monai core added an easy way to add static parameters as in https://github.com/Project-MONAI/tutorials/blob/main/experiment_management/spleen_segmentation_mlflow.ipynb

UNet_metadata = {
    "spatial_dims": 3,
    "in_channels": 1,
    "out_channels": 2,
    "channels": (16, 32, 64, 128, 256),
    "strides": (2, 2, 2, 2),
    "num_res_units": 2,
    "norm": Norm.BATCH,
}
model = UNet(**UNet_metadata).to(device)
# log_params takes a dictionary
mlflow.log_params(UNet_metadata)

can you elaborate how we can use this with in the trainer in monai label

AHarouni avatar Jul 18 '23 21:07 AHarouni

MLflow handler is currently used.. but you can try to derive methods and try

SachidanandAlle avatar Jul 19 '23 06:07 SachidanandAlle