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

Error Pytorch backend training - Expected object of scalar type #92

Closed
PiyushM1 opened this issue Aug 4, 2020 · 4 comments
Closed

Error Pytorch backend training - Expected object of scalar type #92

PiyushM1 opened this issue Aug 4, 2020 · 4 comments
Labels
help wanted Extra attention is needed Solution Added Solution to the bug/issue provided. Check in process.

Comments

@PiyushM1
Copy link
Contributor

PiyushM1 commented Aug 4, 2020

I used the pytorch backend to train 2 models with number of classes as 49 and 16. When I started training the third model with similar conditions, but with 174 classes, I received this error.

Attaching the screenshots. I believe there's nothing I can do because of the abstraction from using monk. Please suggest a fix.
Screenshot 2020-08-04 at 2 26 01 PM
Screenshot 2020-08-04 at 2 26 16 PM
Screenshot 2020-08-04 at 2 26 30 PM

@abhi-kumar
Copy link
Contributor

Share the dataset details and your code. Please check if the training csv has the right labels.

@PiyushM1
Copy link
Contributor Author

PiyushM1 commented Aug 4, 2020

I had earlier trained the same model with a keras backend, it had worked that time, so I don't think the labels are incorrect. Moreover, the labels for the other two classifiers are also prepared in the same way.

Code: https://colab.research.google.com/drive/1Qt0UvKNbdUTwXbbh544bjJ6_7vhvol_f?usp=sharing

Check the Model Classifier part of the code (2nd classifier)

@abhi-kumar
Copy link
Contributor

Your csv file for model classification contains a mix of strings and integers as classes, make sure every label is a string; and there are no white spaces in class names;

Suggestion 1- if your class name is an integer, say 30, change it to "cls_30"
Suggestion 2 - if you class name has white space, say "sonata hybrid", change it to "sonata_hybrid"

@abhi-kumar abhi-kumar changed the title Error when training with Pytorch backend Error Pytorch backend training - Expected object of scalar type Aug 4, 2020
@abhi-kumar abhi-kumar added help wanted Extra attention is needed Solution Added Solution to the bug/issue provided. Check in process. labels Aug 4, 2020
@PiyushM1
Copy link
Contributor Author

PiyushM1 commented Aug 4, 2020

Thank you. I replaced the spaces with underscores and it worked.

@PiyushM1 PiyushM1 closed this as completed Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Solution Added Solution to the bug/issue provided. Check in process.
Projects
None yet
Development

No branches or pull requests

2 participants