Feat/web chat multimodal#182
Merged
Merged
Conversation
…ention)
The 1024-token crash exposed the real cap. Gemma's vision encoder uses
non-causal attention, which requires the whole image in one micro-batch:
GGML_ASSERT(causal_attn || n_ubatch >= n_tokens). Our n_ubatch defaulted to
512, so:
* images > 512 tokens hard-abort (the EULLM_IMAGE_MAX_TOKENS=1024 SIGABRT),
* and effective image resolution was silently capped at 512 tokens
regardless of image_max_tokens — which is why 280 vs 512 gave identical
output: the model never actually received more than ~512 image tokens.
Fix: in the multimodal context only, set both n_batch and n_ubatch to
max(config.n_batch, EULLM_IMAGE_MAX_TOKENS, 512). Now raising the image
budget genuinely increases resolution instead of crashing, and we can finally
test whether more resolution fixes the hard (dark / portrait) images. Text
and scheduler contexts are untouched (no VRAM regression there).
Over beta.2: fix the non-causal vision attention cap — n_ubatch is now sized to the image token budget, so EULLM_IMAGE_MAX_TOKENS=1024/2048 actually raises resolution instead of crashing (SIGABRT) or being silently capped at 512 tokens. This is the build to test whether more resolution fixes the hard (dark / portrait) images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.