8000 [Feature]: Plot training and validation losses overlaid on same chart automatically by writing code (not manually in web interface) · Issue #7887 · wandb/wandb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Feature]: Plot training and validation losses overlaid on same chart automatically by writing code (not manually in web interface) #7887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aj96 opened this issue Jul 1, 2024 · 4 comments
Labels
a:sdk Area: sdk related issues c:sdk:custom-charts Component: Custom Charts and define_metric - wandb.plot and rest of vega based custom charts ty:feature type of the issue is a feature request

Comments

@aj96
Copy link
aj96 commented Jul 1, 2024

Description

In Tensorboard, when you have separate tensorboard writers, one for train and another for validation, it automatically overlays scalars with the same name on the same chart (see picture attached). This is useful because it makes it easier to spot overfitting. I have tried looking up how to do this using wandb, but it seems you can only manually do this in the web interface. This is cumbersome because I do not want to have to manually click and type multiple times every time I run a new experiment to overlay my train and val losses, and most times there are multiple losses plotted as I plot each subloss that contributes to the overall summed total loss. So if I have 5 sublosses and a total loss, I would have to manually overlay the losses 6 times each time I run an experiment. This is too cumbersome, and this is core functionality that any ML engineer would want.

If there is already a solution to automatically overlay scalars on the same chart by configuring it to do so in the python code, please tell me. But I looked at this open issue that is a year and a half old which asked for this functionality (link: #4449), and the wandb reply was to provide a link to the documentation (https://docs.wandb.ai/guides/app/features/panels/line-plot#compare-two-metrics-on-one-chart) on how to manually use the web interface to overlay two metrics, which is not what was asked for.
tensorboard_train_vs_val_loss

Suggested Solution

Possible solutions would be to have the ability to define multiple writers like in tensorboard or to add a group argument to wandb.log() method so we can specify which scalars should be grouped onto the same chart.

Alternatives

No response

Additional Context

No response

@aj96 aj96 changed the title [Feature]: Plot training and validations losses overlaid on same chart automatically by writing code (not manually in web interface) [Feature]: Plot training and validation losses overlaid on same chart automatically by writing code (not manually in web interface) Jul 1, 2024
@JoanaMarieL
Copy link

Hello @aj96 , thank you for writing in and for the very detailed information. Could you please try the following if these will help your case:

Workspaces API and more examples here: https://github.com/wandb/wandb-workspaces

@aj96
Copy link
Author
8000 aj96 commented Jul 2, 2024

@JoanaMarieL I did pip install wandb-workspaces and then tried making my own custom workspace with a custom section and a custom panel containing a LinePlot following the example in the readme here: https://github.com/wandb/wandb-workspaces
But it gives me this error: AttributeError: module 'wandb_workspaces.reports' has no attribute 'LinePlot'

Also, please correct me if I'm wrong, but the examples you provided only allow me to write via code how I want the sections and panels to be, but none of the examples show how to write code to plot multiple y values on the same panel, which is what is necessary for overlaying two plots on the same chart. The examples shown with the pictures show making a section with multiple panels, where each panel is its own separate x vs y plot, so even if I stopped getting errors, I don't think these examples will work. To be clear, I would like to plot two y's against the same x on the same chart/panel by writing code and I would like to update the log in real-time each time I log each step, just like in tensorboard.

@JoanaMarieL
Copy link

Hi @aj96 ,

"I did pip install wandb-workspaces and then tried making my own custom workspace with a custom section and a custom panel containing a LinePlot following the example in the readme here: https://github.com/wandb/wandb-workspaces
But it gives me this error: AttributeError: module 'wandb_workspaces.reports' has no attribute 'LinePlot'"
--could you please share the code snippet you tried so we could review why you are getting the error

And for plotting multiple line plot, you may refer to these:

  1. Plotting Multiple Lines
  2. Select MultiLine tab.

@JoanaMarieL
Copy link

Hi @aj96 , since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!

@kptkin kptkin added c:sdk:public-api Component: All the issues that relate to wandb.Api with the exception of the public api of Artifacts ty:feature type of the issue is a feature request c:sdk:custom-charts Component: Custom Charts and define_metric - wandb.plot and rest of vega based custom charts a:sdk Area: sdk related issues and removed c:sdk:public-api Component: All the issues that relate to wandb.Api with the exception of the public api of Artifacts labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:sdk Area: sdk related issues c:sdk:custom-charts Component: Custom Charts and define_metric - wandb.plot and rest of vega based custom charts ty:feature type of the issue is a feature request
Projects
None yet
Development

No branches or pull requests

3 participants
0