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

llamamodel: fix embedding crash for >512 tokens after #2310 #2383

Merged
merged 1 commit into from
May 29, 2024

Conversation

cebtenzzre
Copy link
Member

n_ubatch defaults to 512, but as of the latest llama.cpp you cannot pass more than n_ubatch tokens to BERT without hitting an assertion failure.

Tested with this python code:

from gpt4all import Embed4All
m = Embed4All('nomic-embed-text-v1.f16.gguf')
e = m.embed('a ' * 513)

Without this PR, it crashes with an assertion failure (including in release builds, since it's a GGML_ASSERT). With this PR, it succeeds.

Broken by #2310 because of ggerganov/llama.cpp#6017
Fix based on ggerganov/llama.cpp#6296
Fixes #2375

n_ubatch defaults to 512, but as of the latest llama.cpp you cannot pass
more than n_ubatch tokens to the embedding model without hitting an
assertion failure.

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
@cebtenzzre cebtenzzre requested a review from manyoso May 28, 2024 18:59
@cebtenzzre cebtenzzre merged commit e94177e into main May 29, 2024
6 of 19 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.

llama.cpp assertion fails: "non-causal attention requires n_ubatch >= n_tokens"
2 participants