Skip to content

Commit 224cbba

Browse files
committed
add image marker tokens
1 parent c6c2d66 commit 224cbba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/llava/mtmd.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,17 @@ int32_t mtmd_tokenize(mtmd_context * ctx,
203203
// https://github.com/huggingface/transformers/blob/1cd110c6cb6a6237614130c470e9a902dbc1a4bd/docs/source/en/model_doc/pixtral.md
204204
marker_modified = ctx->image_marker + "[IMG_END]";
205205
string_replace_all(prompt_modified, ctx->image_marker, marker_modified);
206-
}
207206

208-
else if (proj_type == PROJECTOR_TYPE_QWEN2VL || proj_type == PROJECTOR_TYPE_QWEN25VL) {
207+
} else if (proj_type == PROJECTOR_TYPE_QWEN2VL || proj_type == PROJECTOR_TYPE_QWEN25VL) {
209208
// <|vision_start|> ... (image embeddings) ... <|vision_end|>
210209
marker_modified = "<|vision_start|>" + ctx->image_marker + "<|vision_end|>";
211210
string_replace_all(prompt_modified, ctx->image_marker, marker_modified);
212211

212+
} else if (proj_type == PROJECTOR_TYPE_LLAMA4) {
213+
// <|image_start|> ... (image embeddings) ... <|image_end|>
214+
marker_modified = "<|image_start|>" + ctx->image_marker + "<|image_end|>";
215+
string_replace_all(prompt_modified, ctx->image_marker, marker_modified);
216+
213217
}
214218

215219
// llava-1.5, llava-1.6, Yi-VL, Yi-34B, granite: don't need to add prefix and suffix

0 commit comments

Comments
 (0)