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