Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrintTableMetricsCallback does not handle metrics with periods #955

Open
anaoum opened this issue Dec 14, 2022 · 1 comment
Open

PrintTableMetricsCallback does not handle metrics with periods #955

anaoum opened this issue Dec 14, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed won't fix This will not be worked on

Comments

@anaoum
Copy link

anaoum commented Dec 14, 2022

🐛 Bug

When logged metrics have a period, the PrintTableMetricsCallback produces a KeyError.

To Reproduce

Code sample

from pl_bolts.callbacks.printing import dicts_to_table

print(dicts_to_table([{"metrics/class.a": 0.5}]))

Expected behavior

metrics/class.a
---------------
0.5

Actual behavior

Traceback (most recent call last):
  File "/home/coder/temp.py", line 3, in <module>
    dicts_to_table([{"metrics/class.a": 0.5}])
  File "/home/coder/.direnv/python-3.8.10/lib/python3.8/site-packages/pl_bolts/utils/stability.py", line 87, in wrapper
    return cls_or_callable(*args, **kwargs)
  File "/home/coder/.direnv/python-3.8.10/lib/python3.8/site-packages/pl_bolts/callbacks/printing.py", line 129, in dicts_to_table
    line = s.format(**d, **marked_values)
KeyError: 'metrics/class'

Environment

  • PyTorch Version (e.g., 1.0): 1.12.1+cu116
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): pip
  • Build command you used (if compiling from source): N/A
  • Python version: 3.8
  • CUDA/cuDNN version: 11.6
  • GPU models and configuration: N/A
  • Any other relevant information: N/A

Additional context

The underlying problem is here, python format strings cannot have a period in variable names. To reproduce underlying issue:

"{metrics/class.a}".format(**{"metrics/class.a": 0.5})
@anaoum anaoum added the help wanted Extra attention is needed label Dec 14, 2022
@stale stale bot added the won't fix This will not be worked on label Mar 18, 2023
@Borda Borda added fix fixing issues... bug Something isn't working and removed fix fixing issues... labels Jun 20, 2023
@Borda Borda changed the title PrintTableMetricsCallback does not handle metrics with periods PrintTableMetricsCallback does not handle metrics with periods Jun 20, 2023
@Lightning-Universe Lightning-Universe deleted a comment from stale bot Jun 20, 2023
@Borda
Copy link
Member

Borda commented Jun 20, 2023

@anaoum, would you be interested in sending a fix? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants