pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/llama.cpp: Update to 0.0.2.5541



Module Name:	pkgsrc-wip
Committed By:	Ryo ONODERA <ryoon%NetBSD.org@localhost>
Pushed By:	ryoon
Date:		Sat May 31 01:48:40 2025 +0900
Changeset:	f61c4e6e2c83d5a57db488ab922f88b69ed3a487

Modified Files:
	llama.cpp/Makefile
	llama.cpp/PLIST
	llama.cpp/distinfo
Added Files:
	llama.cpp/patches/patch-common_common.cpp
	llama.cpp/patches/patch-common_minja_minja.hpp
	llama.cpp/patches/patch-ggml_src_ggml-cpu_ggml-cpu.cpp
	llama.cpp/patches/patch-src_llama-chat.cpp
	llama.cpp/patches/patch-src_llama-vocab.cpp

Log Message:
wip/llama.cpp: Update to 0.0.2.5541

* Enable curl support to download models.
* Fix runtime error non-English chat, for example in Japanese.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=f61c4e6e2c83d5a57db488ab922f88b69ed3a487

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 llama.cpp/Makefile                                 | 14 +++++++++---
 llama.cpp/PLIST                                    | 13 +++++------
 llama.cpp/distinfo                                 | 11 ++++++---
 llama.cpp/patches/patch-common_common.cpp          | 26 ++++++++++++++++++++++
 llama.cpp/patches/patch-common_minja_minja.hpp     | 22 ++++++++++++++++++
 .../patches/patch-ggml_src_ggml-cpu_ggml-cpu.cpp   | 17 ++++++++++++++
 llama.cpp/patches/patch-src_llama-chat.cpp         | 17 ++++++++++++++
 llama.cpp/patches/patch-src_llama-vocab.cpp        | 22 ++++++++++++++++++
 8 files changed, 128 insertions(+), 14 deletions(-)

diffs:
diff --git a/llama.cpp/Makefile b/llama.cpp/Makefile
index ba17abb518..14ce73ee79 100644
--- a/llama.cpp/Makefile
+++ b/llama.cpp/Makefile
@@ -3,18 +3,25 @@
 DISTNAME=	llama.cpp-${GITHUB_TAG}
 PKGNAME=	${DISTNAME:S/-b/-0.0.2./}
 CATEGORIES=	devel
-MASTER_SITES=	${MASTER_SITE_GITHUB:=ggerganov/}
-GITHUB_TAG=	b4743
+MASTER_SITES=	${MASTER_SITE_GITHUB:=ggml-org/}
+GITHUB_TAG=	b5541
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	https://github.com/ggerganov/llama.cpp/
 COMMENT=	LLM inference in C/C++
 LICENSE=	mit
 
-USE_TOOLS+=		git pkg-config
+USE_TOOLS+=		pkg-config
 USE_LANGUAGES=		c c++
 USE_CXX_FEATURES=	c++17
 
+DEPENDS+=	${PYPKGPREFIX}-torch>=2.2:../../math/py-torch
+DEPENDS+=	${PYPKGPREFIX}-numpy>=1.25:../../math/py-numpy
+DEPENDS+=	${PYPKGPREFIX}-gguf>=0.14:../../math/py-gguf
+DEPENDS+=	${PYPKGPREFIX}-transformers>=4.35.2:../../math/py-transformers
+DEPENDS+=	${PYPKGPREFIX}-protobuf>=4.21.0:../../devel/py-protobuf
+DEPENDS+=	${PYPKGPREFIX}-sentencepiece>=0.1.98:../../textproc/py-sentencepiece
+
 BLAS_INDEX64=		yes
 BLAS_ACCEPTED=		openblas_pthread #openblas_openmp
 BLAS_C_INTERFACE=	yes
@@ -36,6 +43,7 @@ SUBST_MESSAGE.findblas=	Fixing libpci soname
 SUBST_FILES.findblas+=	ggml/src/ggml-blas/CMakeLists.txt
 SUBST_SED.findblas+=	-e 's,DepBLAS openblas64,DepBLAS ${BLAS_PC},'
 
+.include "../../www/curl/buildlink3.mk"
 .include "../../devel/cmake/build.mk"
 .include "../../lang/python/application.mk"
 .include "../../mk/blas.buildlink3.mk"
diff --git a/llama.cpp/PLIST b/llama.cpp/PLIST
index 4ef1f1c684..937d6629d0 100644
--- a/llama.cpp/PLIST
+++ b/llama.cpp/PLIST
@@ -9,28 +9,23 @@ bin/llama-cvector-generator
 bin/llama-embedding
 bin/llama-eval-callback
 bin/llama-export-lora
-bin/llama-gbnf-validator
+bin/llama-finetune
 bin/llama-gen-docs
 bin/llama-gguf
 bin/llama-gguf-hash
 bin/llama-gguf-split
 bin/llama-gritlm
 bin/llama-imatrix
-bin/llama-infill
-bin/llama-llava-cli
-bin/llama-llava-clip-quantize-cli
 bin/llama-lookahead
 bin/llama-lookup
 bin/llama-lookup-create
 bin/llama-lookup-merge
 bin/llama-lookup-stats
-bin/llama-minicpmv-cli
+bin/llama-mtmd-cli
 bin/llama-parallel
 bin/llama-passkey
 bin/llama-perplexity
 bin/llama-quantize
-bin/llama-quantize-stats
-bin/llama-qwen2vl-cli
 bin/llama-retrieval
 bin/llama-run
 bin/llama-save-load-state
@@ -45,6 +40,7 @@ include/ggml-alloc.h
 include/ggml-backend.h
 include/ggml-blas.h
 include/ggml-cann.h
+include/ggml-cpp.h
 include/ggml-cpu.h
 include/ggml-cuda.h
 include/ggml-kompute.h
@@ -66,5 +62,6 @@ lib/libggml-blas.so
 lib/libggml-cpu.so
 lib/libggml.so
 lib/libllama.so
-lib/libllava_shared.so
+lib/libmtmd_helper_shared.so
+lib/libmtmd_shared.so
 lib/pkgconfig/llama.pc
diff --git a/llama.cpp/distinfo b/llama.cpp/distinfo
index 0bf7c11234..4ab4ab89f4 100644
--- a/llama.cpp/distinfo
+++ b/llama.cpp/distinfo
@@ -1,5 +1,10 @@
 $NetBSD$
 
-BLAKE2s (llama.cpp-b4743.tar.gz) = 0280af04367584be943e3f20fad68e602661292aad0738fc16b50024537aea6d
-SHA512 (llama.cpp-b4743.tar.gz) = e093f4c7d4b2de425932bb4960683527a8a3bba242132c2f5e5bfed8480f0e336a06f97baf2d20ee591c6deee7535e159d40884a5e3f7caf0ae0967b8a046850
-Size (llama.cpp-b4743.tar.gz) = 20723735 bytes
+BLAKE2s (llama.cpp-b5541.tar.gz) = 7cab4b75c1165ab20af40c6f877fb3e767c8e0cf79a9c9c2d742920bc8b2aabf
+SHA512 (llama.cpp-b5541.tar.gz) = ae9cc84182a06f48ec2d298370518972adea5ff68999ab8ade07703f0ddf77dc01de3b6c903da5b8c4f5e7544d6b3ddda07970fa7d8fbab4d622a9a6c63019a9
+Size (llama.cpp-b5541.tar.gz) = 24929231 bytes
+SHA1 (patch-common_common.cpp) = 1655bf8b58bdddb5e9f6d2e00a23ad92869d305d
+SHA1 (patch-common_minja_minja.hpp) = 70e9079a80c840534633e980697ae86233a392c3
+SHA1 (patch-ggml_src_ggml-cpu_ggml-cpu.cpp) = cc5f9840919818b824eb52585a3c5a8ee40a2835
+SHA1 (patch-src_llama-chat.cpp) = ec70b79842f448472142f65205ebbbc9728b07b6
+SHA1 (patch-src_llama-vocab.cpp) = b97f36b85855ccf1385dfdd9fd5417e1abf77024
diff --git a/llama.cpp/patches/patch-common_common.cpp b/llama.cpp/patches/patch-common_common.cpp
new file mode 100644
index 0000000000..98a3fd0311
--- /dev/null
+++ b/llama.cpp/patches/patch-common_common.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- common/common.cpp.orig	2025-05-30 10:24:37.000000000 +0000
++++ common/common.cpp
+@@ -401,10 +401,10 @@ std::string string_format(const char * f
+ std::string string_strip(const std::string & str) {
+     size_t start = 0;
+     size_t end = str.size();
+-    while (start < end && std::isspace(str[start])) {
++    while (start < end && std::isspace((unsigned char)(str[start]))) {
+         start++;
+     }
+-    while (end > start && std::isspace(str[end - 1])) {
++    while (end > start && std::isspace((unsigned char)(str[end - 1]))) {
+         end--;
+     }
+     return str.substr(start, end - start);
+@@ -849,7 +849,7 @@ std::string fs_get_cache_directory() {
+     if (getenv("LLAMA_CACHE")) {
+         cache_directory = std::getenv("LLAMA_CACHE");
+     } else {
+-#if defined(__linux__) || defined(__FreeBSD__) || defined(_AIX) || defined(__OpenBSD__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(_AIX) || defined(__OpenBSD__) || defined(__NetBSD__)
+         if (std::getenv("XDG_CACHE_HOME")) {
+             cache_directory = std::getenv("XDG_CACHE_HOME");
+         } else {
diff --git a/llama.cpp/patches/patch-common_minja_minja.hpp b/llama.cpp/patches/patch-common_minja_minja.hpp
new file mode 100644
index 0000000000..6d49c75fae
--- /dev/null
+++ b/llama.cpp/patches/patch-common_minja_minja.hpp
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- common/minja/minja.hpp.orig	2025-05-16 09:49:49.097392207 +0000
++++ common/minja/minja.hpp
+@@ -1524,7 +1524,7 @@ public:
+             vargs.expectArgs("title method", {0, 0}, {0, 0});
+             auto res = str;
+             for (size_t i = 0, n = res.size(); i < n; ++i) {
+-              if (i == 0 || std::isspace(res[i - 1])) res[i] = std::toupper(res[i]);
++              if (i == 0 || std::isspace((unsigned char)(res[i - 1]))) res[i] = std::toupper(res[i]);
+               else res[i] = std::tolower(res[i]);
+             }
+             return res;
+@@ -1602,7 +1602,7 @@ private:
+ 
+     bool consumeSpaces(SpaceHandling space_handling = SpaceHandling::Strip) {
+       if (space_handling == SpaceHandling::Strip) {
+-        while (it != end && std::isspace(*it)) ++it;
++        while (it != end && std::isspace((unsigned char)(*it))) ++it;
+       }
+       return true;
+     }
diff --git a/llama.cpp/patches/patch-ggml_src_ggml-cpu_ggml-cpu.cpp b/llama.cpp/patches/patch-ggml_src_ggml-cpu_ggml-cpu.cpp
new file mode 100644
index 0000000000..3681e277ce
--- /dev/null
+++ b/llama.cpp/patches/patch-ggml_src_ggml-cpu_ggml-cpu.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- ggml/src/ggml-cpu/ggml-cpu.cpp.orig	2025-05-16 09:51:15.207576848 +0000
++++ ggml/src/ggml-cpu/ggml-cpu.cpp
+@@ -276,10 +276,10 @@ struct ggml_backend_cpu_device_context {
+                     char * p = strchr(buf, ':');
+                     if (p) {
+                         p++;
+-                        while (std::isspace(*p)) {
++                        while (std::isspace((unsigned char)(*p))) {
+                             p++;
+                         }
+-                        while (std::isspace(p[strlen(p) - 1])) {
++                        while (std::isspace((unsigned char)(p[strlen(p) - 1]))) {
+                             p[strlen(p) - 1] = '\0';
+                         }
+                         description = p;
diff --git a/llama.cpp/patches/patch-src_llama-chat.cpp b/llama.cpp/patches/patch-src_llama-chat.cpp
new file mode 100644
index 0000000000..a767ff36f7
--- /dev/null
+++ b/llama.cpp/patches/patch-src_llama-chat.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- src/llama-chat.cpp.orig	2025-05-16 09:52:08.885488932 +0000
++++ src/llama-chat.cpp
+@@ -16,10 +16,10 @@
+ static std::string trim(const std::string & str) {
+     size_t start = 0;
+     size_t end = str.size();
+-    while (start < end && isspace(str[start])) {
++    while (start < end && isspace((unsigned char)(str[start]))) {
+         start += 1;
+     }
+-    while (end > start && isspace(str[end - 1])) {
++    while (end > start && isspace((unsigned char)(str[end - 1]))) {
+         end -= 1;
+     }
+     return str.substr(start, end - start);
diff --git a/llama.cpp/patches/patch-src_llama-vocab.cpp b/llama.cpp/patches/patch-src_llama-vocab.cpp
new file mode 100644
index 0000000000..df8efd5c0b
--- /dev/null
+++ b/llama.cpp/patches/patch-src_llama-vocab.cpp
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- src/llama-vocab.cpp.orig	2025-05-16 09:52:44.723654390 +0000
++++ src/llama-vocab.cpp
+@@ -2264,7 +2264,7 @@ void llama_vocab::impl::tokenizer_st_par
+                         int64_t left_reminder_length = match - raw_text_base_offset;
+ 
+                         if (data.attr & LLAMA_TOKEN_ATTR_LSTRIP) {
+-                            while (left_reminder_length > 0 && isspace(raw_text[left_reminder_offset + left_reminder_length - 1])) {
++                            while (left_reminder_length > 0 && isspace((unsigned char)(raw_text[left_reminder_offset + left_reminder_length - 1]))) {
+                                 left_reminder_length--;
+                             }
+                         }
+@@ -2289,7 +2289,7 @@ void llama_vocab::impl::tokenizer_st_par
+                         int64_t right_reminder_length = raw_text_base_length - ((match - raw_text_base_offset) + text.length());
+ 
+                         if (data.attr & LLAMA_TOKEN_ATTR_RSTRIP) {
+-                            while (right_reminder_length > 0 && isspace(raw_text[right_reminder_offset])) {
++                            while (right_reminder_length > 0 && isspace((unsigned char)(raw_text[right_reminder_offset]))) {
+                                 right_reminder_offset++;
+                                 right_reminder_length--;
+                             }


Home | Main Index | Thread Index | Old Index