2

I'm, working on a a DL project and using pytorch lightning and torchmetrics.

I'm using a metric that is just irrelevant for examples, which means that there exist batches for which this metric will get a NaN value. The problem is the aggregated value for the function epoch-wise is also computed to be NaN because of that. Is there a possible workaround? torchmetrics is very convenient and I would like to avoid a switch.

I have seen the torchmetrics.MeanMetric object (and similar ones) but I couldn't make it work. If the solution goes through this kind of object I would very much appreciate an example.

Michael M.
  • 10,486
  • 9
  • 18
  • 34
  • I also have a similar problem. I am also getting NaN values using Kendall Rank Coefficient. NaN values are only present when I use batches. If I load my dataloader with batch = 1 I see no NaN values. – gudé Mar 16 '23 at 22:08

0 Answers0