log_metric: raise helpful error if a nested metric is logged and parent key exists as a metric
This could happen without treating step as a metric. For example, even without step, you could get the same error for epoch here if you include epoch-level metrics.
We should fail in log_metric if a nested metric (foo/bar) is logged and any of the parent keys already exists in the summary.
Originally posted by @daavoo in https://github.com/iterative/dvclive/issues/490#issuecomment-1458800074
See https://github.com/iterative/dvclive/pull/490#issuecomment-1458747287 for more context.
Summary: If you have already logged a metric like {"step": 0} and try to log a nested metric like {"step": {"loss": 0.5}}, you will get an error like:
File "/Users/dave/Code/dvclive/src/dvclive/utils.py", line 35, in nested_update
d[k] = nested_update(d.get(k, {}), v)
AttributeError: 'int' object has no attribute 'get'