Cannot access run data via run.history()

Hi,

I am having trouble accessing run data keys in several of my runs. Specifically, I have logged a metric in my code, the metric is tracked in the online wandb UI, but when I try accessing the data using the following code

import wandb
api = wandb.Api()
run = api.run("xxxxxx")
run.history()[['_step', 'metric_name']]

It throws a KeyError: "['metric_name'] not in index".

When I print out run.history() in table format, it does show ‘metric_name’ as one of the columns; ‘metric_name’ also appears as a key in run.summary. I wonder what is the issue here?

Would appreciate any help. Thank you!

Hi @toruowo thank you for writing in! Can you please change your last line to:

run.history(keys=['_step', 'metric_name'])

Would this work for you? Please let me know if you have any further issues or questions. You may also find some more API examples here if that helps.

Thank you! Yes, this indeed resolves the problem!

Glad to hear that @toruowo thank you for confirming. I will close the ticket for now, and please reach out again if you have any further questions!

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