I am tracking metrics by using the wandb.log() method . I would like later to be able to retrieve some of the metrics. I see some suggests the attribute history of run, but this seems not exists . The summary attribute also seems to do the job, but it would return only the “last” ones. Is there a way to return everything that was logged with the log method?
There are some code snippets on the project overview page:
import wandb api = wandb.Api() # run is specified by <entity>/<project>/<run_id> run = api.run("<entity>/<project>/<run_id>") # save the metrics for the run to a csv file metrics_dataframe = run.history() metrics_dataframe.to_csv("metrics.csv")
import wandb api = wandb.Api() run = api.run("<entity>/<project>/<run_id>") history = run.scan_history() losses = [row["loss"] for row in history]```
Hi @davideseddio thanks for writing in! The
Summary metrics are indeed the last value of your logged metrics. If you’re logging metrics over time/steps then you could retrieve them using our Public API with the methods
scan_history. The difference between the two is that the latter would return the unsampled metrics (all your steps) while the former returns sampled metrics (similar as rendered in the W&B App’s Workspace).
Please find below an example from our Docs and feel free to ask if you had any other questions:
run = api.run("l2k2/examples-numpy-boston/i0wt6xua") history = run.scan_history(keys=["Loss"]) losses = [row["Loss"] for row in history]