Section 02: Facing the error TypeError: __new__() missing 1 required positional argument: 'task' #318
Answered
by
mrdbourke
karthikbhandary2
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
mrdbourke
Mar 1, 2023
Replies: 2 comments 1 reply
-
Could you post your code of |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey @karthikbhandary2, Good question! There's been an update to TorchMetrics since the video was recorded. Please see the fix here: #200 (comment) Or alternatively, you can try: try:
from torchmetrics import Accuracy
except:
!pip install torchmetrics==0.9.3 # this is the version we're using in this notebook (later versions exist here: https://torchmetrics.readthedocs.io/en/stable/generated/CHANGELOG.html#changelog)
from torchmetrics import Accuracy
# Setup metric and make sure it's on the target device
torchmetrics_accuracy = Accuracy(task='multiclass', num_classes=4).to(device)
# Calculate accuracy
torchmetrics_accuracy(y_preds, y_blob_test) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
karthikbhandary2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @karthikbhandary2,
Good question!
There's been an update to TorchMetrics since the video was recorded.
Please see the fix here: #200 (comment)
Or alternatively, you can try: