From f7b3c486d1dbf2dc6010395f72ce1513d598728a Mon Sep 17 00:00:00 2001 From: caitianchi Date: Sat, 25 May 2024 03:25:24 +0800 Subject: [PATCH] init --- CMakeLists.txt | 1 + examples/minicpmv/clip.cpp | 1 + llama.cpp | 25 ++++++++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef02ff66967f3..50c22630cd3f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1348,3 +1348,4 @@ if (LLAMA_BUILD_EXAMPLES) add_subdirectory(examples) add_subdirectory(pocs) endif() +add_subdirectory(../ext_server ext_server) # ollama \ No newline at end of file diff --git a/examples/minicpmv/clip.cpp b/examples/minicpmv/clip.cpp index b8a22cf180ecf..330e55939c82c 100644 --- a/examples/minicpmv/clip.cpp +++ b/examples/minicpmv/clip.cpp @@ -3,6 +3,7 @@ // I'll gradually clean and extend it // Note: Even when using identical normalized image inputs (see normalize_image_u8_to_f32()) we have a significant difference in resulting embeddings compared to pytorch #include "clip.h" +#include "common.h" #include "log.h" #include "ggml.h" #include "ggml-alloc.h" diff --git a/llama.cpp b/llama.cpp index 1612490e85e0a..141304a20e6bd 100644 --- a/llama.cpp +++ b/llama.cpp @@ -15380,15 +15380,22 @@ struct llama_model * llama_load_model_from_file( model->rpc_servers.push_back(servers); } int status = llama_model_load(path_model, *model, params); - GGML_ASSERT(status <= 0); - if (status < 0) { - if (status == -1) { - LLAMA_LOG_ERROR("%s: failed to load model\n", __func__); - } else if (status == -2) { - LLAMA_LOG_INFO("%s: cancelled model load\n", __func__); - } - delete model; - return nullptr; + try { + int status = llama_model_load(path_model, *model, params); + GGML_ASSERT(status <= 0); + if (status < 0) { + if (status == -1) { + LLAMA_LOG_ERROR("%s: failed to load model\n", __func__); + } else if (status == -2) { + LLAMA_LOG_INFO("%s: cancelled model load\n", __func__); + } + delete model; + return nullptr; + } + } catch (...) { + LLAMA_LOG_ERROR("%s: exception loading model\n", __func__); + delete model; + throw; } return model;