Skip to content

Commit 76ede4a

Browse files
committed
fix out_of_range error to keep the chat loop running
1 parent 3e168be commit 76ede4a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/llava/mtmd-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ int main(int argc, char ** argv) {
308308
}
309309
g_is_generating = true;
310310
if (line.find("/image") == 0) {
311-
std::string image = line.substr(7);
311+
std::string image = (line.size()>=7) ? line.substr(7) : "";
312312
images_fname.push_back(string_strip(image));
313313
content += "<__image__>";
314314
continue;

examples/llava/mtmd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ int32_t mtmd_helper_eval(mtmd_context * ctx,
590590
}
591591

592592
} else if (chunk.type == MTMD_INPUT_CHUNK_TYPE_IMAGE) {
593-
GGML_ASSERT(!is_last && "logits for last image chunk is not yet support");
593+
GGML_ASSERT(!is_last && "logits for last image chunk is not yet supported");
594594
GGML_ASSERT(chunk.tokens_image != nullptr);
595595
int64_t t0 = ggml_time_ms();
596596
if (ctx->print_timings) {

0 commit comments

Comments
 (0)