summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@friendly-machines.com>2025-04-25 11:12:40 +0200
committerDanny Milosavljevic <dannym@friendly-machines.com>2025-04-25 11:14:58 +0200
commit9407c6370e212cf60e19cd846fb4313290287553 (patch)
tree1636ffc76068a7a42627e5ca922fbf023cd8a764 /gnu
parent501a9603f5e3cda07f3be8e7fecac31f7af5ce52 (diff)
Revert "gnu: llama-cpp: Update to 0.0.0-b5013."
This reverts commit 2dacbe7f6dd8409a1e159813a4b1bc6f248e69b1. Change-Id: I08735448d3186745132b22ac3c2f5cf71c95c1db
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/machine-learning.scm47
1 files changed, 30 insertions, 17 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 4698acccbb1..9b2eaed17f6 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -80,7 +80,6 @@
80 #:use-module (gnu packages compression) 80 #:use-module (gnu packages compression)
81 #:use-module (gnu packages cpp) 81 #:use-module (gnu packages cpp)
82 #:use-module (gnu packages cran) 82 #:use-module (gnu packages cran)
83 #:use-module (gnu packages curl)
84 #:use-module (gnu packages crates-check) 83 #:use-module (gnu packages crates-check)
85 #:use-module (gnu packages crates-crypto) 84 #:use-module (gnu packages crates-crypto)
86 #:use-module (gnu packages crates-io) 85 #:use-module (gnu packages crates-io)
@@ -643,7 +642,7 @@ Performance is achieved by using the LLVM JIT compiler.")
643 (deprecated-package "guile-aiscm-next" guile-aiscm)) 642 (deprecated-package "guile-aiscm-next" guile-aiscm))
644 643
645(define-public llama-cpp 644(define-public llama-cpp
646 (let ((tag "b5013")) 645 (let ((tag "b4549"))
647 (package 646 (package
648 (name "llama-cpp") 647 (name "llama-cpp")
649 (version (string-append "0.0.0-" tag)) 648 (version (string-append "0.0.0-" tag))
@@ -651,19 +650,19 @@ Performance is achieved by using the LLVM JIT compiler.")
651 (origin 650 (origin
652 (method git-fetch) 651 (method git-fetch)
653 (uri (git-reference 652 (uri (git-reference
654 (url "https://github.com/ggml-org/llama.cpp") 653 (url "https://github.com/ggerganov/llama.cpp")
655 (commit tag))) 654 (commit tag)))
656 (file-name (git-file-name name tag)) 655 (file-name (git-file-name name tag))
657 (sha256 656 (sha256
658 (base32 "0s73dz871x53dr366lkzq19f677bwgma2ri8m5vhbfa9p8yp4p3r")))) 657 (base32 "1xf2579q0r8nv06kj8padi6w9cv30w58vdys65nq8yzm3dy452a1"))
658 (patches
659 (search-patches "llama-cpp-vulkan-optional.patch"))))
659 (build-system cmake-build-system) 660 (build-system cmake-build-system)
660 (arguments 661 (arguments
661 (list 662 (list
662 #:configure-flags 663 #:configure-flags
663 #~(list #$(string-append "-DGGML_BUILD_NUMBER=" tag) 664 #~(list "-DBUILD_SHARED_LIBS=ON"
664 "-DBUILD_SHARED_LIBS=ON"
665 "-DGGML_VULKAN=ON" 665 "-DGGML_VULKAN=ON"
666 "-DLLAMA_CURL=ON"
667 "-DGGML_BLAS=ON" 666 "-DGGML_BLAS=ON"
668 "-DGGML_BLAS_VENDOR=OpenBLAS" 667 "-DGGML_BLAS_VENDOR=OpenBLAS"
669 (string-append "-DBLAS_INCLUDE_DIRS=" 668 (string-append "-DBLAS_INCLUDE_DIRS="
@@ -693,17 +692,32 @@ Performance is achieved by using the LLVM JIT compiler.")
693 (substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp" 692 (substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp"
694 (("\"/bin/sh\"") 693 (("\"/bin/sh\"")
695 (string-append "\"" (search-input-file inputs "/bin/sh") "\""))))) 694 (string-append "\"" (search-input-file inputs "/bin/sh") "\"")))))
696 (add-after 'unpack 'fix-tests 695 (add-after 'unpack 'disable-unrunable-tests
697 (lambda _ 696 (lambda _
698 ;; test-eval-callback downloads ML model from network, cannot 697 ;; test-eval-callback downloads ML model from network, cannot
699 ;; run in Guix build environment 698 ;; run in Guix build environment
700 (substitute* '("examples/eval-callback/CMakeLists.txt") 699 (substitute* '("examples/eval-callback/CMakeLists.txt")
701 (("COMMAND llama-eval-callback") 700 (("COMMAND llama-eval-callback")
702 "COMMAND true llama-eval-callback")) 701 "COMMAND true llama-eval-callback"))))
703 ;; Help it find the test files it needs 702 (add-before 'install 'install-python-scripts
704 (substitute* "tests/test-chat.cpp" 703 (lambda _
705 (("\"\\.\\./\"") "\"../source/\"")))) 704 (let ((bin (string-append #$output "/bin/")))
706 (add-after 'install 'wrap-python-scripts 705 (define (make-script script)
706 (let ((suffix (if (string-suffix? ".py" script) "" ".py")))
707 (call-with-input-file
708 (string-append "../source/" script suffix)
709 (lambda (input)
710 (call-with-output-file (string-append bin script)
711 (lambda (output)
712 (format output "#!~a/bin/python3\n~a"
713 #$(this-package-input "python")
714 (get-string-all input))))))
715 (chmod (string-append bin script) #o555)))
716 (mkdir-p bin)
717 (make-script "convert_hf_to_gguf")
718 (make-script "convert_llama_ggml_to_gguf")
719 (make-script "convert_hf_to_gguf_update.py"))))
720 (add-after 'install-python-scripts 'wrap-python-scripts
707 (assoc-ref python:%standard-phases 'wrap)) 721 (assoc-ref python:%standard-phases 'wrap))
708 (add-after 'install 'remove-tests 722 (add-after 'install 'remove-tests
709 (lambda* (#:key outputs #:allow-other-keys) 723 (lambda* (#:key outputs #:allow-other-keys)
@@ -711,13 +725,12 @@ Performance is achieved by using the LLVM JIT compiler.")
711 (string-append (assoc-ref outputs "out") 725 (string-append (assoc-ref outputs "out")
712 "/bin") 726 "/bin")
713 "^test-"))))))) 727 "^test-")))))))
714 (inputs (list curl glslang python python-gguf-llama-cpp 728 (inputs (list python vulkan-headers vulkan-loader))
715 vulkan-headers vulkan-loader)) 729 (native-inputs (list pkg-config shaderc bash))
716 (native-inputs (list pkg-config shaderc bash-minimal))
717 (propagated-inputs 730 (propagated-inputs
718 (list python-numpy python-pytorch python-sentencepiece openblas)) 731 (list python-numpy python-pytorch python-sentencepiece openblas))
719 (properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available 732 (properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available
720 (home-page "https://github.com/ggml-org/llama.cpp") 733 (home-page "https://github.com/ggerganov/llama.cpp")
721 (synopsis "Port of Facebook's LLaMA model in C/C++") 734 (synopsis "Port of Facebook's LLaMA model in C/C++")
722 (description "This package provides a port to Facebook's LLaMA collection 735 (description "This package provides a port to Facebook's LLaMA collection
723of foundation language models. It requires models parameters to be downloaded 736of foundation language models. It requires models parameters to be downloaded