Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions sdk/plugins/llama_cpp/src/vlm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,19 @@ int32_t LlamaVlm::create(const geniex_VlmCreateInput* input) {

// Initialize vision context if mmproj_path provided
if (input->mmproj_path) {
ggml_backend_dev_t htp_device = device == Device::NPU ? ggml_backend_dev_by_name("HTP0") : nullptr;

mtmd_context_params mparams = mtmd_context_params_default();
mparams.use_gpu = device == Device::GPU || htp_device != nullptr;
mparams.device = htp_device;
mparams.print_timings = false;
mparams.n_threads = 4;
mparams.use_gpu = false;
if (!selection->empty()) {
mparams.use_gpu = true;
mparams.device = selection->data()[0];
}
mparams.print_timings = false;
mparams.n_threads = 4;
// Zack TODO: elegant fix this error: no member named 'verbosity' in 'mtmd_context_params'
// mparams.verbosity = GGML_LOG_LEVEL_ERROR;

this->ctx_vision = mtmd_init_from_file(input->mmproj_path, this->model, mparams);
if (!this->ctx_vision && htp_device) {
if (!this->ctx_vision && !selection->empty()) {
GENIEX_LOG_WARN("mtmd failed to initialize the vision encoder on HTP; falling back to CPU");
mparams.use_gpu = false;
mparams.device = nullptr;
Expand Down
Loading