Wandb Tables to Latex Tables, anyway?

I discovered Wandb few years back but I finally sat down to integrate everything with my experiments. I am loving this so much! Something I’d like to know is if there is anyway to export tables to Latex from Wandb itself.

I’m in ML research and I have to include my results in Latex tables for papers. So it would be really cool if I could export them from Wandb, just like reports or graphs. I’m open to suggestions you may have. thank you

(willing to submit a feature request as well)

1 Like

Thanks for sharing this. This is an interesting idea and would definitely be a valuable function for other W&B users! Just to clarify, is this to display metrics from your runs within Latex Tables or are you looking to extract information from our model evaluation tool W&B Tables?

If you’re looking for metrics from your runs, you can use the Runs API to get these, which you could then format into a Latex Table dynamically. I’ve seen this being done from the team at Github to display run metrics within a markdown table in Github Issue comments:

1 Like

So thanks to a chat in Reddit, progress has been made on this. Just putting runs into a DataFrame using the runs api and then use to_latex.


import pandas as pd 
import wandb

api = wandb.Api()
entity, project = "<entity>", "<project>"  # set to your entity and project 
runs = api.runs(entity + "/" + project) 

summary_list, config_list, name_list = [], [], []
for run in runs: 
    # .summary contains the output keys/values for metrics like accuracy.
    #  We call ._json_dict to omit large files 
    summary_list.append(run.summary._json_dict)

    # .config contains the hyperparameters.
    #  We remove special values that start with _.
    config_list.append(
        {k: v for k,v in run.config.items()
         if not k.startswith('_')})

    # .name is the human-readable name of the run.
    name_list.append(run.name)

runs_df = pd.DataFrame({
    "summary": summary_list,
    "config": config_list,
    "name": name_list
    })

runs_df.to_latex()