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 generation with large sequences #2561

Merged

Conversation

l-k-11235
Copy link
Contributor

@l-k-11235 l-k-11235 commented Feb 13, 2024

This PR fixes a bug in generation when the length of the sequence is larger than 2048 tokens, due to a mismatch between the size the KV cache and the dimensions of the rotation matrix involved in the RoPE method (RuntimeError: cos/sin seqlen must be at least the seqlen of KV cache)
It fixes the dynamic resizing of rotary embeddings which is applied when the size of the sequence exceeds theirs.

@vince62s
Copy link
Member

I don't think this is the right fix because it just translates it to 4096. In theory when the length is greater than the maxseqlen we need to extend.
I think the test where we check if the length is greater than maxseqlen is not done at the right place when the initial length is longer than 2048.

@vince62s vince62s merged commit 0e72326 into OpenNMT:master Feb 22, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants