Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Code Error #839

Open
IlanVinograd opened this issue Feb 26, 2024 · 0 comments
Open

Fix Code Error #839

IlanVinograd opened this issue Feb 26, 2024 · 0 comments

Comments

@IlanVinograd
Copy link

image

from torchmetrics import Accuracy

acc_fn = Accuracy(num_classes=len(fashion_mnist_class_names)).to(device)

This line must be fixed because it giving error -> Traceback (most recent call last):
File "D:\Visual Studio Projects\PyTorch\PyTorch.py", line 124, in
acc_fn = Accuracy(num_classes=len(fashion_mnist_class_names))
TypeError: new() missing 1 required positional argument: 'task'
Press any key to continue . . .

this may be due to updates to the torchmetrics library, where creating an instance of the Accuracy class now requires an important function for which the metric is stored.

fixed line:

from torchmetrics import Accuracy

acc_fn = Accuracy(num_classes=len(fashion_mnist_class_names), average='macro', task='multiclass')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant