Error at 13:56:08: TypeError: Accuracy.__new__() missing 1 required positional argument: 'task' #904
Unanswered
Claudiu-Mihael-Terenche
asked this question in
Q&A
Replies: 1 comment
-
num classes = # Place your how many classes of colored blobs are there in numeric value
torchmetric_accuracy = Accuracy(task="multiclass", num_classes=num_classes).to(device) |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
At 13:56:08, after I installed torch metrics with
!pip install torchmetrics
when I ran
from torchmetrics import Accuracy
Setup metric
torchmetric_accuracy = Accuracy().to(device)
Calculate accuracy
torchmetric_accuracy(y_preds, y_blob_test)
I encountered an error
TypeError Traceback (most recent call last)
in <cell line: 4>()
2
3 # Setup metric
----> 4 torchmetric_accuracy = Accuracy().to(device)
5
6 # Calculate accuracy
TypeError: Accuracy.new() missing 1 required positional argument: 'task'
What is wrong, and how should I fix it? I used exactly the same code as in tutorial.
PS. I ran the Daniel's file
https://colab.research.google.com/github/mrdbourke/pytorch-deep-learning/blob/main/video_notebooks/02_pytorch_classification_video.ipynb#scrollTo=YsKTgOmhlqyJ
and I encountered the same error. Maybe something changed in torchmetrics since he made the video.
Beta Was this translation helpful? Give feedback.
All reactions