-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"Wrong shape for input_ids" error when running basic example on Windows #452
Comments
I sadly don't know why this happens. Everything looks right. |
If I use the model |
Never experienced that issue. Maybe you can try some other release version of sentence-transfomers / transformers / pytorch and see if it solves the issue? |
I think I had that error yesterday. The reason was that my transformers version was the newest. Try to reinstall sentence_transformers so transformers will be downgraded again: |
Thanks for the message. I tried it, but it seems sbert.net is not available right now, so I cannot download the models from there. But if I clone the repo and take the models from there, the error stays the same. |
@PhilipMay @danielplatt @nreimers Any solution to this error? Also gets it |
I have the same problem in linux. It is an existing problem on transformers thread (cisnlp/simalign#10 (comment)).. @nreimers Kindly have a look. I am having the same issue pytorch 1.6 |
Have the same problem. Downgrading the transformer package to 3.0.2 as mentioned in this issue (huggingface/transformers#5907) might help but not when training models with PyTorch/XLA since there was a bug in the transformer version when trying to do inference on CPU (huggingface/transformers#5636). So it seems that currently there is no way to train models with PyTorch/XLA and using sentence-transformers afterwords. @nreimers did you already have time to look into the problem? |
Is there any solution for this? |
I checked out the link you provided and used their fix which also works here. It seems like a simple transformation of the tensors is all that's needed. Don't know what changed in the newer transformers version that this is needed though. Just need two lines at the beginning of the
The method looks like this after my fix:
Using a model trained from scratch with the latest transformers version works but I can't guarantee that this doesn't break something else. I'd also guess that this will break functionality with older versions of the transformers package (not tested). It could be a good starting point though in finding a permanent solution. Hope this helps. |
When running the following code:
I get the following error:
ValueError: Wrong shape for input_ids (shape torch.Size([39])) or attention_mask (shape torch.Size([39]))
(Notice I replaced file paths by X, so those are not the real file paths)
Using Windows 10, Anaconda, PyTorch 1.6, transformers 3.1.0, sentence-transformers 0.3.6. What should I do to run the above example?
The text was updated successfully, but these errors were encountered: