Nested Log structure which is visible in the UI

i have a model with some somemodules. I want to log the weights and gradients using a nested “folder”-strukture so that i can for example navigate like this:

gradients-modeltype1 -model1
gradietns-modeltype1-model2
gradients-model2
gradietns-parameters

and the same with the weights. preferably like a dropdown navigation

your doku states:

Logging nested metrics is encouraged and is supported in the W&B UI. If you log with a nested dictionary like wandb.log({"train": {"acc": 0.9}, "val": {"acc": 0.8}}), the metrics will be organized into train and val sections in the W&B UI.

so i tried to use the nested dict stucture with:

..
                     weights = layer.get_weights()
                        if len(weights) == 1:
                            metrics.update(flatten_dict.flatten({
                                "weights": {
                                    model_type: {
                                        model.name: {
                                            layer.name + ".weights": _convert_weights(weights[0], histogram=histogram)
                                        }
                                    }
                                }
                            }))
....
return flatten_dict.unflatten(metrics)

but all i get are pathnames with dots in the middle. no folding stucture. like this I even only get single histograms for all the biases and weights as a list of 300 elements. Not very usefull.

is there a way to get this working? It realy would help me a lot . I realy hope this feature exists!!

Hi @samdabadei, thank you for raising this as it looks like we need to update the documentation there. We now use the / character for logging nested metrics so this would be done in a flattened dictionary like this:

wandb.log({
    "train/acc" : 0.9,
    "train/loss" : 5.1, 
    "val/acc" : 0.8,
    "val/loss" : 6.7
    })

In the UI this would result in all metrics with the train/ prefix being in the same panel and then all metrics with the val/ being in a separate panel.

Note that there is only one level of nesting available with this so logging a metrics like train/dataset_2/acc would just end up in the train group of panels and wouldn’t be divided into a dataset_2 subgroup.

Let me know if you have any other questions!
Thank you,
Nate

Thanks for the clarificatin. Are your working on deeper nested structures? I think it would be a great improvement!
Is there any other way to get a deeper nested structure? espacially for weight-logging.

1 Like

@samdabadei currently there is not a way to add deeper layers of nesting but I will go ahead and make an internal feature request for this. I can follow up here once the team has had a chance to look into this.

Thank you,
Nate

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.