There is not history when logging wandb.plot.bar?

Hi,
I want to use wandb.plot.bar to log a bar chart, with below code

    table_data = some_function_to_get_data()
    table = wandb.Table(["label", "value"], table_data)
    wandb.log(
        {"a_bar_chart": wandb.plot.bar(table, "label", "value")}, step=global_step,
    )

There are two problems:

  1. there is no bar plot shown in browser, I need to create the a chart and custom it to bar, this is a little weird in the sense that I already told wandb to log a bar, but it does not do it by default
  2. there is no history of the bar chart, only the current bar chart, as we are logging the bar chart, I suppose I can see the history of bar chart, that’s how we call it a log right? So we should able to see the history of both table and bar chart during training.

Maybe I did something wrong?
BTW, I know I can achieve what I want by using matplotlib and log the figure, but I prefer using wandb.pot, as this allows to free of worrying about create and delete the figure object.

Hi @wztdream,

Are you calling these lines of code in a loop? log for Tables are not designed to be called repeatedly right now, but we plan to change this in the future.

I would definitely need some more context into what exactly you are looking to do to help you out best, and a link to your workspace would be great too.

Thanks,
Ramit

thank you for your reply, yes I call these code repeatedly, every training step in my case, and I want to see how the bar chart change over training. So I suppose currently this is not supported, and have to wait until this feature is available :slight_smile:

Got it, what you would like to do instead in this case for now is log all your data under one table, log it when you are done with your table and then use the wandb.plot.bar function.

An alternative (and admittedly not very efficient) hack would be to instantiate a new table object in each loop, copy data from your old table to your new table and then append more data to your new table. This has the potential for having a quadratic memory cost, so I would recommend against it, but if you really need real time logging on tables and have the RAM to support it, this might be an option to consider.

Thanks,
Ramit

let me make it clear, I did not mean log all data in one table. I suppose it should be similar with logging an pyplot.plot figure. In that case there is one plot figure for each step, and there is a nice control bar to review the history figure. It will be nice there is similar control bar for wandb.plot.bar and even for wandb.Table

image

Hi @wztdream,

Apologies for the delay, just wanted to provide an update here - I looked into this and we do not support the step slider on wandb.plot.bar as we do on images, since they work on different underlying mechanisms. That does sound like a great feature request though, and I am creating a feature request to enable this.

For now, I would suggest using wandb.Image to get a step slider based bar graph.

Thanks,
Ramit

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