You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On master (currently 4857546), the implementation of __hash__ on PyTorch Lightning metrics causes an exception to be raised for metric implementations which make use of non-hashable state. One such exception is AveragePrecision, meaning that any model which uses it is currently broken on master.
See above BoringModel. All that's needed to reproduce the bug is installing master (currently 4857546) and adding an AveragePrecision metric to a model. This exception is raised (copied from above Colab link):
Now, the "correct" solution here would be to migrate all metrics using non-hashable state to use hashable alternatives. I have an alternative solution on this branch, which circumvents the issue by allowing lists to be used as state, so long as the contents of those lists are hashable. I leave the decision whether to merge this or go down another route up to the maintainers, but let me know if you would like me to open a Pull Request with this branch's change.
@peblair thanks for catching this bug. Please feel free to open a PR with your suggested solution. As metric states that are list should only contain torch.Tensor they should always be hasable.
🐛 Bug
On
master
(currently 4857546), the implementation of__hash__
on PyTorch Lightning metrics causes an exception to be raised for metric implementations which make use of non-hashable state. One such exception isAveragePrecision
, meaning that any model which uses it is currently broken onmaster
.Please reproduce using the BoringModel
https://colab.research.google.com/drive/1sSMuMoLyeOEtNupTOPC7YuLQonVxBt4H?usp=sharing
To Reproduce
See above BoringModel. All that's needed to reproduce the bug is installing
master
(currently 4857546) and adding anAveragePrecision
metric to a model. This exception is raised (copied from above Colab link):Expected behavior
Not crashing 🙂
Environment
Additional context
The text was updated successfully, but these errors were encountered: