Skip to content

Commit 466c6cd

Browse files
committed
server : (experimental) vision support via libmtmd
1 parent fccf9ca commit 466c6cd

File tree

4 files changed

+458
-81
lines changed

4 files changed

+458
-81
lines changed

common/arg.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,11 @@ static bool common_params_parse_ex(int argc, char ** argv, common_params_context
834834

835835
// allow --mmproj to be set from -hf
836836
// assuming that mmproj is always in the same repo as text model
837-
if (!params.model.hf_repo.empty() && ctx_arg.ex == LLAMA_EXAMPLE_LLAVA) {
837+
if (!params.model.hf_repo.empty() && (
838+
ctx_arg.ex == LLAMA_EXAMPLE_LLAVA || ctx_arg.ex == LLAMA_EXAMPLE_SERVER)) {
838839
params.mmproj.hf_repo = params.model.hf_repo;
839840
}
841+
// TODO @ngxson : this will break non-vision model with -hf, need to fix before merging
840842
common_params_handle_model(params.mmproj, params.hf_token, "", true);
841843

842844
if (params.escape) {
@@ -2101,14 +2103,14 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
21012103
[](common_params & params, const std::string & value) {
21022104
params.mmproj.path = value;
21032105
}
2104-
).set_examples({LLAMA_EXAMPLE_LLAVA}));
2106+
).set_examples({LLAMA_EXAMPLE_LLAVA, LLAMA_EXAMPLE_SERVER}));
21052107
add_opt(common_arg(
21062108
{"--mmproj-url"}, "URL",
21072109
"URL to a multimodal projector file for LLaVA. see examples/llava/README.md",
21082110
[](common_params & params, const std::string & value) {
21092111
params.mmproj.url = value;
21102112
}
2111-
).set_examples({LLAMA_EXAMPLE_LLAVA}));
2113+
).set_examples({LLAMA_EXAMPLE_LLAVA, LLAMA_EXAMPLE_SERVER}));
21122114
add_opt(common_arg(
21132115
{"--image"}, "FILE",
21142116
"path to an image file. use with multimodal models. Specify multiple times for batching",

examples/server/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ endforeach()
3434
add_executable(${TARGET} ${TARGET_SRCS})
3535
install(TARGETS ${TARGET} RUNTIME)
3636

37+
target_include_directories(${TARGET} PRIVATE ../llava)
3738
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
38-
target_link_libraries(${TARGET} PRIVATE common ${CMAKE_THREAD_LIBS_INIT})
39+
target_link_libraries(${TARGET} PRIVATE common mtmd ${CMAKE_THREAD_LIBS_INIT})
3940

4041
if (LLAMA_SERVER_SSL)
4142
find_package(OpenSSL REQUIRED)

0 commit comments

Comments
 (0)