TypeError: accuracy() missing 1 required positional argument: 'task' #591
Answered
by
Surya-Abhinai
andysingal
asked this question in
Q&A
-
i got error:
for code:
i got error:
|
Beta Was this translation helpful? Give feedback.
Answered by
Surya-Abhinai
Aug 8, 2023
Replies: 1 comment 2 replies
-
The function accuracy requires an additional positional argument called task. In your code, you have written training_accuracy = accuracy(preds, targets). This is missing the task argument, so the function will not work correctly. The correct code should be training_accuracy = accuracy(preds, targets, task="multiclass"). |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mrdbourke
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The function accuracy requires an additional positional argument called task. In your code, you have written training_accuracy = accuracy(preds, targets). This is missing the task argument, so the function will not work correctly.
The correct code should be training_accuracy = accuracy(preds, targets, task="multiclass").