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

IndexError: The shape of the mask [425] at index 0 does not match the shape of the indexed tensor [413, 768] at index 0 #3

Open
lenijwp opened this issue Mar 7, 2023 · 3 comments

Comments

@lenijwp
Copy link

lenijwp commented Mar 7, 2023

When I enter a long code snippet, I get an error like this: “IndexError: The shape of the mask [425] at index 0 does not match the shape of the indexed tensor [413, 768] at index 0”. Does this mean that the maximum input length supported by the model configuration is 413 tokens? I was wondering if the API could be further refined to support arbitrary length or automatic truncation.

@urialon
Copy link
Collaborator

urialon commented Mar 7, 2023

Hi @lenijwp ,
Thank you for your interest in our work!

Our code supports unlimited inputs, by chunking long inputs and encoding each chunks separately.
However, 413 tokens do not even require this chunking, because the models' input size is 512.

Can you check whether there's a "newline" character at the end of the input?
If so, can you remove it and check again?
If not, can you provide us with the problematic inputs?

Thanks,
Uri

@lenijwp
Copy link
Author

lenijwp commented Mar 7, 2023

I checked as you suggested and removed the trailing whitespaces and newline characters from the input. The problem has been solved. Thank you for your timely and helpful assistance!

@urialon
Copy link
Collaborator

urialon commented Mar 7, 2023 via email

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

2 participants