How to log a torchmetrics that return multiple values (average=None) #7444
Unanswered
mnslarcher
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment
-
Sorry I see now that it was already asked here: #7373 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I would like to log both the global and the classwise F1 score (or other metrics).
self.log("F1", self.f1, prog_bar=True)
works only if:
self.f1 = F1(num_classes=NUM_CLASSES, average="micro", mdmc_average="global")
but not if:
self.f1 = F1(num_classes=NUM_CLASSES, average=None, mdmc_average="global")
In this second case it complains that:
ValueError: only one element tensors can be converted to Python scalars
There is any smart way to log also the second case or I have to write a for loop and log the value for each class?
What I have to do to ensure that if I use a for loop then the classwise metric is aggretated correctly?
Thanks,
Mario
Beta Was this translation helpful? Give feedback.
All reactions