Run.history(keys=key_list) returns empty history

Hi everyone,

when calling run.history(keys=key_list) with a key_list that contains more than one key with a ‘/’ character in it, an empty history is returned:

history = run.history(keys=["hierarchy_1/metric_1", "hierarchy_1/metric_2"], samples=n_samples)
print(history)

yields this output:

Empty DataFrame
Columns: []
Index: []

However, calling it with only one key in the list yields the full history:

history_metric_1 = run.history(keys=["hierarchy_1/metric_1"], samples=n_samples)
history_metric_2 = run.history(keys=["hierarchy_1/metric_2"], samples=n_samples)

both work and return n_samples steps of the run history.

Calling run.history() without any keys and extracting them afterwards is not an option for me due to another bug in the API, discussed here.

Hi @kolja, thanks a lot for reporting this! I have checked this but it seems I am not getting the same behaviour as you do, by running a code like this:

import wandb

entity = entity_name
project = project_name

run = wandb.init(entity=entity, project=project)
for i in range(5):
  run.log({'hierarchy_1/metric_1':i, 'hierarchy_1/metric_2':1/(i+1)})
id = run.id
run.finish()

api = wandb.Api()
run = api.run(f'{entity}/{project}/{id}')
history = run.history(keys=["hierarchy_1/metric_1", "hierarchy_1/metric_2"], samples=5)
print(history)

I can see both metrics properly:

  _step  hierarchy_1/metric_1  hierarchy_1/metric_2
0      0                     0              1.000000
1      1                     1              0.500000
2      2                     2              0.333333
3      3                     3              0.250000
4      4                     4              0.200000

Could you please try this code and see if it works? Also, could you send me the link of the run and so I can have a look at it and see what type of data are you using because maybe this is affecting? Thanks

Hi Kolja,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,
Luis

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