Notebook 04: torchmetrics.Accuracy error Section 4: Video 97. #200
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
There was indeed a major change through these releases which can be tracked at Lightning-AI/torchmetrics#655 and the referenced issues. They added the |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @AlessandroMiola for fixing this in #203 I just merged the code! Code before (errors): from torchmetrics import Accuracy
torchmetrics_accuracy = Accuracy().to(device)New code: from torchmetrics import Accuracy
torchmetrics_accuracy = Accuracy(task='multiclass', num_classes=4).to(device)See the updated |
Beta Was this translation helpful? Give feedback.
There was indeed a major change through these releases which can be tracked at Lightning-AI/torchmetrics#655 and the referenced issues. They added the
taskarg to discern which object to instantiate depending on the task itself (see the issue for the underlying reasons). For instance, in the multiclass case they're instantiating aMulticlassAccuracyobject (https://github.com/Lightning-AI/metrics/blob/bc057d495703aff5c4d8d671c54060e08a677142/src/torchmetrics/classification/accuracy.py#L359).