mirror of
https://github.com/ollama/ollama.git
synced 2026-09-21 13:38:14 -05:00
llama.cpp: version bump b10969 (#18446)
llama.cpp build changes resulted in duplicate symbols between libllama and libmtmd. This moves the compat patch into libllama with exported symbols.
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
b10864
|
||||
b10969
|
||||
|
||||
Vendored
-13
@@ -13,7 +13,6 @@
|
||||
#include <cerrno>
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -29,20 +28,8 @@ using namespace llama_ollama_compat::detail; // pull detail:: helpers into scope
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef OLLAMA_COMPAT_MTMD_BUILD
|
||||
void ollama_compat_log(const char * format, ...) {
|
||||
std::va_list args;
|
||||
va_start(args, format);
|
||||
std::vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#define OLLAMA_COMPAT_LOG_INFO(...) do { ollama_compat_log(__VA_ARGS__); } while (0)
|
||||
#define OLLAMA_COMPAT_LOG_ERROR(...) ollama_compat_log(__VA_ARGS__)
|
||||
#else
|
||||
#define OLLAMA_COMPAT_LOG_INFO(...) do { LLAMA_LOG_INFO(__VA_ARGS__); } while (0)
|
||||
#define OLLAMA_COMPAT_LOG_ERROR(...) LLAMA_LOG_ERROR(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
double elapsed_ms(std::chrono::steady_clock::time_point start) {
|
||||
return std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - start).count();
|
||||
|
||||
Vendored
+8
-7
@@ -26,6 +26,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "ggml-backend.h" // for ggml_backend_buffer_type_t
|
||||
#include "llama.h" // for LLAMA_API
|
||||
|
||||
struct gguf_context;
|
||||
struct ggml_context;
|
||||
@@ -45,7 +46,7 @@ namespace llama_ollama_compat {
|
||||
// so there's nowhere to write the transformed bytes. Disabling mmap
|
||||
// makes the loader pre-allocate real backend buffers, after which our
|
||||
// load_op overrides land in writable memory.
|
||||
bool translate_metadata(const llama_model_loader * ml,
|
||||
LLAMA_API bool translate_metadata(const llama_model_loader * ml,
|
||||
gguf_context * meta,
|
||||
ggml_context * ctx,
|
||||
std::string & arch_name,
|
||||
@@ -54,19 +55,19 @@ bool translate_metadata(const llama_model_loader * ml,
|
||||
// Called from llama_model_loader's weights_map population loop. Returns
|
||||
// true to drop a tensor from the loader — used to hide embedded vision
|
||||
// tensors from the text model's view without modifying the gguf_context.
|
||||
bool should_skip_tensor(const llama_model_loader * ml, const char * tensor_name);
|
||||
LLAMA_API bool should_skip_tensor(const llama_model_loader * ml, const char * tensor_name);
|
||||
|
||||
// Called from clip_model_loader's constructor. Rewrites the clip-facing
|
||||
// view of the metadata (arch=clip, clip.vision.* KVs, renamed tensors)
|
||||
// so the rest of clip.cpp can load a monolithic GGUF unchanged.
|
||||
void translate_clip_metadata(gguf_context * meta, ggml_context * ctx);
|
||||
LLAMA_API void translate_clip_metadata(gguf_context * meta, ggml_context * ctx);
|
||||
|
||||
// Called from clip.cpp's tensor-loading loop, before the normal file read.
|
||||
// If this tensor was marked for type promotion by translate_clip_metadata
|
||||
// (e.g. F16->F32), performs the conversion and writes the result into
|
||||
// `cur` (host memcpy or backend_tensor_set based on `buft`). Returns true
|
||||
// when the tensor was handled — caller should skip its normal read path.
|
||||
bool maybe_load_tensor(ggml_tensor * cur,
|
||||
LLAMA_API bool maybe_load_tensor(ggml_tensor * cur,
|
||||
const char * source_file,
|
||||
size_t file_offset,
|
||||
ggml_backend_buffer_type_t buft);
|
||||
@@ -75,7 +76,7 @@ bool maybe_load_tensor(ggml_tensor * cur,
|
||||
// the model file path from the per-loader registry populated by
|
||||
// translate_metadata, and derives the buffer type from cur->buffer
|
||||
// internally, which keeps the call site in the patch to one line.
|
||||
bool maybe_load_text_tensor(const llama_model_loader * ml,
|
||||
LLAMA_API bool maybe_load_text_tensor(const llama_model_loader * ml,
|
||||
ggml_tensor * cur,
|
||||
size_t file_offset);
|
||||
|
||||
@@ -89,7 +90,7 @@ bool maybe_load_text_tensor(const llama_model_loader * ml,
|
||||
// this hook replaced), the cache holds one active tensor per loader.
|
||||
// Returns the requested range (copied into buf when buf is non-null) or
|
||||
// nullptr when no load op exists for this tensor.
|
||||
const void * maybe_load_text_tensor_range(const llama_model_loader * ml,
|
||||
LLAMA_API const void * maybe_load_text_tensor_range(const llama_model_loader * ml,
|
||||
ggml_tensor * cur,
|
||||
size_t offs,
|
||||
size_t size,
|
||||
@@ -99,6 +100,6 @@ const void * maybe_load_text_tensor_range(const llama_model_loader * ml,
|
||||
// positive embedding size only for Ollama compatibility cases whose projector
|
||||
// metadata already follows upstream naming, but whose legacy projector type
|
||||
// is missing from that helper in the pinned llama.cpp version.
|
||||
int maybe_clip_mmproj_embd(const char * projector_type, int projection_dim);
|
||||
LLAMA_API int maybe_clip_mmproj_embd(const char * projector_type, int projection_dim);
|
||||
|
||||
} // namespace llama_ollama_compat
|
||||
|
||||
@@ -269,19 +269,16 @@ unset(_llama_cpp_root)
|
||||
# Link the Ollama-compat source files into the fetched llama target.
|
||||
# Kept separate from the hook patch so our .cpp/.h stay
|
||||
# on-disk in llama/compat/ rather than being copied into _deps/.
|
||||
if(_ollama_link_compat_sources AND DEFINED OLLAMA_LLAMA_CPP_COMPAT_DIR)
|
||||
if(_ollama_link_compat_sources AND DEFINED OLLAMA_LLAMA_CPP_COMPAT_DIR AND TARGET llama)
|
||||
file(GLOB _compat_sources CONFIGURE_DEPENDS
|
||||
${OLLAMA_LLAMA_CPP_COMPAT_DIR}/*.cpp)
|
||||
foreach(_compat_target IN ITEMS llama mtmd)
|
||||
if(TARGET ${_compat_target})
|
||||
target_sources(${_compat_target} PRIVATE ${_compat_sources})
|
||||
target_include_directories(${_compat_target} PRIVATE
|
||||
${OLLAMA_LLAMA_CPP_COMPAT_DIR}
|
||||
${llama_cpp_SOURCE_DIR}/src)
|
||||
endif()
|
||||
endforeach()
|
||||
target_sources(llama PRIVATE ${_compat_sources})
|
||||
set_source_files_properties(${_compat_sources}
|
||||
TARGET_DIRECTORY llama
|
||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
target_include_directories(llama PRIVATE ${OLLAMA_LLAMA_CPP_COMPAT_DIR})
|
||||
if(TARGET mtmd)
|
||||
target_compile_definitions(mtmd PRIVATE OLLAMA_COMPAT_MTMD_BUILD)
|
||||
target_include_directories(mtmd PRIVATE ${OLLAMA_LLAMA_CPP_COMPAT_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user