We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 37bdd92 + 2d8a1db commit 38d7996Copy full SHA for 38d7996
examples/mtmd/mtmd-helper.cpp
@@ -185,6 +185,13 @@ int32_t mtmd_helper_decode_image_chunk(
185
int n_mmproj_embd = llama_model_n_embd_inp(model);
186
int n_pos_per_embd = mtmd_decode_use_mrope(ctx) ? 4 : 1;
187
188
+ // ensure we don't exceed n_ubatch, otherwise llama_decode will try to split the batch
189
+ // which will break M-RoPE positional embeddings
190
+ int32_t n_ubatch = llama_n_ubatch(lctx);
191
+ if (n_batch > n_ubatch) {
192
+ n_batch = n_ubatch;
193
+ }
194
+
195
int32_t n_tokens = mtmd_input_chunk_get_n_tokens(chunk);
196
int32_t i_batch = 0;
197
int32_t n_img_batches = GGML_PAD(n_tokens, n_batch) / n_batch;
0 commit comments