Use the W&B Reports and Workspaces API to create and manage reports and workspaces programmatically
The W&B Reports and Workspaces API, accessible at wandb_workspaces, allows you to create reports, which can be published on the web to share findings, and well as customize a workspace where training and fine-tuning work was done.
View the source code
W&B Report and Workspace API is in Public Preview.
Installation and setup
Sign up and create an API key
To authenticate your machine with W&B, you must first generate an API key at User settings.
Install and import packages
Install the W&B Report and Workspaces library.
pip install wandb-workspaces
Create a report
To create a report, specify your team’s entity and provide a name for your report. Replace enclosed text with your values:
import wandb_workspaces.reports.v2 as wr # Createreport = wr.Report( entity="<team_entity>", project="<project_name>", title='Quickstart Report', description="That was easy!")# Save reportreport.save()
Next, add blocks and panels to your report. For example, the following code creates a report with a table of contents, header, and a paragraph:
report.blocks = [ wr.TableOfContents(), wr.H1("Text and images example"), wr.P("Lorem ipsum dolor sit amet."),]report.save()
The following code shows how to create a workspace with a section containing three panels: a line plot, a bar plot, and a scalar chart. Replace enclosed text with your values:
# How to importimport wandb_workspaces.workspaces as ws# Create a workspacews.Workspace( entity="<team_entity>", # entity that owns the workspace project="<project_name>", # project that the workspace is associated with sections=[ ws.Section( name="<Validation Metrics>", panels=[ wr.LinePlot(x="Step", y=["<val_loss>"]), wr.BarPlot(metrics=["<val_accuracy>"]), wr.ScalarChart(metric="<f1_score>", groupby_aggfunc="<mean>"), ], is_open=True, ), ],)workspace.save()