summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorNigko Yerden <nigko.yerden@gmail.com>2026-03-22 09:12:42 +0500
committerCayetano Santos <csantosb@inventati.org>2026-03-24 11:28:48 +0100
commitff3accfef4cb462251b5fabf9dfc3c9d53d51e70 (patch)
tree440db9a5d64d9ea722d8eb3544fb976a09c75b75 /gnu/packages
parent642382f87564a0959a95ebabd197842334751601 (diff)
gnu: llama-cpp: Further debloat and improve.
Reduces closure size from ~700 downto 291 MiB. Note that coreutils is required by 'env' program referensed in 'bin/convert_hf_to_gguf.py'. * gnu/packages/machine-learning.scm (llama-cpp)[arguments]: Delete #:modules and #:imported-modules. <#:phases>{patch-paths}: Delete. {fix-tests}: Delete string substitutions for "tests/CMakeLists.txt" that do nothing. {wrap-python-scripts}: Delete. {fix-python-shebang}: Add. [inputs]: Delete all inputs except 'ggml and 'openssl; add 'coreutils. [native-inputs]: Replace with 'python and 'python-jinja2 inputs. [propatated-inputs]: Delete. Merges guix/guix!7396 Change-Id: I64229d6cfa096e32926672bed55125f22c9ca7eb Signed-off-by: Cayetano Santos <csantosb@inventati.org> Modified-by: Cayetano Santos <csantosb@inventati.org>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/machine-learning.scm46
1 files changed, 13 insertions, 33 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 1dd5a6d70da..91682458a3e 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -852,22 +852,8 @@ NumPy @code{dtype} extensions used in machine learning libraries, including:
#:configure-flags
#~(list "-DBUILD_SHARED_LIBS=ON"
"-DLLAMA_USE_SYSTEM_GGML=ON")
- #:modules '((ice-9 textual-ports)
- (guix build utils)
- ((guix build python-build-system) #:prefix python:)
- (guix build cmake-build-system))
- #:imported-modules `(,@%cmake-build-system-modules
- (guix build python-build-system))
#:phases
#~(modify-phases %standard-phases
- (add-after 'unpack 'patch-paths
- (lambda* (#:key inputs #:allow-other-keys)
- (substitute* (format #f "~a~a"
- "ggml/src/ggml-vulkan/vulkan-shaders/"
- "vulkan-shaders-gen.cpp")
- (("\"/bin/sh\"")
- (string-append "\"" (search-input-file inputs "/bin/sh")
- "\"")))))
(add-after 'unpack 'fix-tests
(lambda _
;; test-thread-safety downloads ML model from network,
@@ -882,16 +868,6 @@ NumPy @code{dtype} extensions used in machine learning libraries, including:
"")
(("set_tests_properties\\(test-state-restore-fragmented.*")
"")
- (((string-append "llama_build_and_test\\"
- "(test-eval-callback-download-model.cpp.*"))
- "")
- (((string-append "set_tests_properties\\"
- "(test-eval-callback-download-model.*"))
- "")
- (("llama_build_and_test\\(test-eval-callback.cpp.*")
- "")
- (("set_tests_properties\\(test-eval-callback.*")
- "")
(("llama_build_and_test\\(test-llama-archs.cpp.*")
"")
(("set_tests_properties\\(test-download-model.*")
@@ -913,20 +889,24 @@ NumPy @code{dtype} extensions used in machine learning libraries, including:
;; Help it find the test files it needs
(substitute* "tests/test-chat.cpp"
(("\"\\.\\./\"") "\"../source/\""))))
- (add-after 'install 'wrap-python-scripts
- (assoc-ref python:%standard-phases 'wrap))
(add-after 'install 'remove-tests
(lambda _
(for-each delete-file
(find-files (string-append #$output "/bin")
- "^test-")))))))
- (inputs
- (list curl ggml glslang python-minimal spirv-headers
- spirv-tools vulkan-headers vulkan-loader openssl))
+ "^test-"))))
+ ;; This phase and coreutils are needed to reduce the closure size
+ ;; of this package. Remove them when not needed anymore.
+ (add-after 'patch-shebangs 'fix-python-shebang
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* (string-append #$output
+ "/bin/convert_hf_to_gguf.py")
+ (("^#!.*/bin/python3")
+ (string-append "#!" (search-input-file inputs "bin/env")
+ " python3"))))))))
+ (inputs (list coreutils ggml openssl))
(native-inputs
- (list bash-minimal pkg-config python-minimal-wrapper shaderc))
- (propagated-inputs
- (list python-numpy python-jinja2 python-sentencepiece))
+ ;; These are only used in the check phase for test-jinja-py
+ (list python python-jinja2))
(properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available
(home-page "https://github.com/ggml-org/llama.cpp")
(synopsis "Port of Facebook's LLaMA model in C/C++")