From: Mathieu Baudier Date: Mon, 23 Jun 2025 12:15:36 +0000 (+0200) Subject: Introduce mtmd support X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=e76fe12e439f0e60d6546e29d4708e15b4c7ab99;p=pkg%2Fggml%2Fsources%2Fllama.cpp Introduce mtmd support --- diff --git a/debian/control b/debian/control index b6da3e1d..a2ed121a 100644 --- a/debian/control +++ b/debian/control @@ -26,11 +26,23 @@ Description: Inference of large language models in pure C/C++ (shared library) llama.cpp leverages the ggml tensor library in order to run large language models (LLMs) provided in the GGUF file format. +Package: libmtmd0 +Section: libs +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends}, + libllama0 +# Explicitly conflict with Debian official +Conflicts: llama.cpp +Description: Inference of large language models in pure C/C++ (multimodal library) + mtmd provides multimodl inference. + # We only distribute a few very useful tools, with stable CLI options Package: llama-cpp-tools Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, - libllama0, ggml, curl + libllama0 (= ${binary:Version}), libmtmd0 (= ${binary:Version}), ggml, curl Description: Inference of large language models in pure C/C++ (tools) llama-cli: versatile tool wrapping most features provided by libllama. It typically allows one to run one-shot prompts or to "chat" @@ -42,6 +54,8 @@ Description: Inference of large language models in pure C/C++ (tools) . llama-bench: benchmarking of large language models or ggml backends. + . + llama-mtmd-cli: multimodal support. Package: libllama0-dev Section: libdevel @@ -51,3 +65,13 @@ Depends: ${misc:Depends}, Description: Inference of large language models in pure C/C++ (development files) Development files required for building software based on the stable and documented llama.cpp API. + +Package: libmtmd0-dev +Section: libdevel +Architecture: any +Depends: ${misc:Depends}, + ggml-dev, libllama0-dev (= ${binary:Version}), libmtmd0 (= ${binary:Version}) +Description: Inference of large language models in pure C/C++ (development files) + Development files required for building software based on the + stable and documented llama.cpp API. + \ No newline at end of file diff --git a/debian/libmtmd0-dev.install b/debian/libmtmd0-dev.install new file mode 100644 index 00000000..f482f6d3 --- /dev/null +++ b/debian/libmtmd0-dev.install @@ -0,0 +1,4 @@ +/usr/include/mtmd*.h + +# Symbolic links +/usr/lib/*/libmtmd.so diff --git a/debian/libmtmd0.install b/debian/libmtmd0.install new file mode 100644 index 00000000..8e15aa09 --- /dev/null +++ b/debian/libmtmd0.install @@ -0,0 +1 @@ +/usr/lib/*/libmtmd.so.* diff --git a/debian/llama-cpp-tools.install b/debian/llama-cpp-tools.install index a028e995..eaed1f25 100644 --- a/debian/llama-cpp-tools.install +++ b/debian/llama-cpp-tools.install @@ -6,3 +6,6 @@ /usr/bin/llama-bench /usr/libexec/*/ggml/llama-bench + +/usr/bin/llama-mtmd-cli +/usr/libexec/*/ggml/llama-mtmd-cli diff --git a/debian/not-installed b/debian/not-installed index 05710147..c02e7add 100644 --- a/debian/not-installed +++ b/debian/not-installed @@ -1,7 +1,3 @@ -# Ignore multimodal until the mtmd approach seems stable enough -/usr/lib/*/libmtmd.so -/usr/include/mtmd*.h - # Most executables produced are not stable enough to be distributed /usr/bin/llama-* /usr/libexec/*/ggml/llama-* diff --git a/debian/patches/0001-improve-cmake-build.patch b/debian/patches/0001-improve-cmake-build.patch index a2a78d9b..445d3ca2 100644 --- a/debian/patches/0001-improve-cmake-build.patch +++ b/debian/patches/0001-improve-cmake-build.patch @@ -3,9 +3,10 @@ Date: Sun, 23 Feb 2025 11:31:46 +0100 Subject: improve-cmake-build --- - CMakeLists.txt | 2 +- - src/CMakeLists.txt | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) + CMakeLists.txt | 2 +- + src/CMakeLists.txt | 4 ++++ + tools/mtmd/CMakeLists.txt | 4 ++++ + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50801cd..d2becb0 100644 @@ -33,3 +34,18 @@ index 8f9cd65..9aa905a 100644 + set_target_properties(llama PROPERTIES VERSION ${LLAMA_INSTALL_VERSION} SOVERSION 0) + endif() endif() +diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt +index 4baa15b..c330f06 100644 +--- a/tools/mtmd/CMakeLists.txt ++++ b/tools/mtmd/CMakeLists.txt +@@ -35,6 +35,10 @@ set_target_properties(mtmd + PROPERTIES + PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS}") + ++if(DEFINED LLAMA_INSTALL_VERSION) ++ message(STATUS "Set mtmd shared library version to ${LLAMA_INSTALL_VERSION}") ++ set_target_properties(mtmd PROPERTIES VERSION ${LLAMA_INSTALL_VERSION} SOVERSION 0) ++endif() + install(TARGETS mtmd LIBRARY PUBLIC_HEADER) + + if (NOT MSVC) diff --git a/debian/rules b/debian/rules index 352d27f5..5730a8dd 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all override_dh_auto_configure: dh_auto_configure -- \ - -DBUILD_NUMBER=$(subst 0.0.,,$(DEB_VERSION_UPSTREAM)) \ + -DLLAMA_BUILD_NUMBER=$(subst 0.0.,,$(DEB_VERSION_UPSTREAM)) \ -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ \