mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
0a2521e3ed
commit
2dacbe7f6d
1 changed files with 17 additions and 30 deletions
|
@ -80,6 +80,7 @@
|
||||||
#:use-module (gnu packages compression)
|
#:use-module (gnu packages compression)
|
||||||
#:use-module (gnu packages cpp)
|
#:use-module (gnu packages cpp)
|
||||||
#:use-module (gnu packages cran)
|
#:use-module (gnu packages cran)
|
||||||
|
#:use-module (gnu packages curl)
|
||||||
#:use-module (gnu packages crates-check)
|
#:use-module (gnu packages crates-check)
|
||||||
#:use-module (gnu packages crates-crypto)
|
#:use-module (gnu packages crates-crypto)
|
||||||
#:use-module (gnu packages crates-io)
|
#:use-module (gnu packages crates-io)
|
||||||
|
@ -642,7 +643,7 @@ Performance is achieved by using the LLVM JIT compiler.")
|
||||||
(deprecated-package "guile-aiscm-next" guile-aiscm))
|
(deprecated-package "guile-aiscm-next" guile-aiscm))
|
||||||
|
|
||||||
(define-public llama-cpp
|
(define-public llama-cpp
|
||||||
(let ((tag "b4549"))
|
(let ((tag "b5013"))
|
||||||
(package
|
(package
|
||||||
(name "llama-cpp")
|
(name "llama-cpp")
|
||||||
(version (string-append "0.0.0-" tag))
|
(version (string-append "0.0.0-" tag))
|
||||||
|
@ -650,19 +651,19 @@ Performance is achieved by using the LLVM JIT compiler.")
|
||||||
(origin
|
(origin
|
||||||
(method git-fetch)
|
(method git-fetch)
|
||||||
(uri (git-reference
|
(uri (git-reference
|
||||||
(url "https://github.com/ggerganov/llama.cpp")
|
(url "https://github.com/ggml-org/llama.cpp")
|
||||||
(commit tag)))
|
(commit tag)))
|
||||||
(file-name (git-file-name name tag))
|
(file-name (git-file-name name tag))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "1xf2579q0r8nv06kj8padi6w9cv30w58vdys65nq8yzm3dy452a1"))
|
(base32 "0s73dz871x53dr366lkzq19f677bwgma2ri8m5vhbfa9p8yp4p3r"))))
|
||||||
(patches
|
|
||||||
(search-patches "llama-cpp-vulkan-optional.patch"))))
|
|
||||||
(build-system cmake-build-system)
|
(build-system cmake-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
(list
|
(list
|
||||||
#:configure-flags
|
#:configure-flags
|
||||||
#~(list "-DBUILD_SHARED_LIBS=ON"
|
#~(list #$(string-append "-DGGML_BUILD_NUMBER=" tag)
|
||||||
|
"-DBUILD_SHARED_LIBS=ON"
|
||||||
"-DGGML_VULKAN=ON"
|
"-DGGML_VULKAN=ON"
|
||||||
|
"-DLLAMA_CURL=ON"
|
||||||
"-DGGML_BLAS=ON"
|
"-DGGML_BLAS=ON"
|
||||||
"-DGGML_BLAS_VENDOR=OpenBLAS"
|
"-DGGML_BLAS_VENDOR=OpenBLAS"
|
||||||
(string-append "-DBLAS_INCLUDE_DIRS="
|
(string-append "-DBLAS_INCLUDE_DIRS="
|
||||||
|
@ -692,32 +693,17 @@ Performance is achieved by using the LLVM JIT compiler.")
|
||||||
(substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp"
|
(substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp"
|
||||||
(("\"/bin/sh\"")
|
(("\"/bin/sh\"")
|
||||||
(string-append "\"" (search-input-file inputs "/bin/sh") "\"")))))
|
(string-append "\"" (search-input-file inputs "/bin/sh") "\"")))))
|
||||||
(add-after 'unpack 'disable-unrunable-tests
|
(add-after 'unpack 'fix-tests
|
||||||
(lambda _
|
(lambda _
|
||||||
;; test-eval-callback downloads ML model from network, cannot
|
;; test-eval-callback downloads ML model from network, cannot
|
||||||
;; run in Guix build environment
|
;; run in Guix build environment
|
||||||
(substitute* '("examples/eval-callback/CMakeLists.txt")
|
(substitute* '("examples/eval-callback/CMakeLists.txt")
|
||||||
(("COMMAND llama-eval-callback")
|
(("COMMAND llama-eval-callback")
|
||||||
"COMMAND true llama-eval-callback"))))
|
"COMMAND true llama-eval-callback"))
|
||||||
(add-before 'install 'install-python-scripts
|
;; Help it find the test files it needs
|
||||||
(lambda _
|
(substitute* "tests/test-chat.cpp"
|
||||||
(let ((bin (string-append #$output "/bin/")))
|
(("\"\\.\\./\"") "\"../source/\""))))
|
||||||
(define (make-script script)
|
(add-after 'install 'wrap-python-scripts
|
||||||
(let ((suffix (if (string-suffix? ".py" script) "" ".py")))
|
|
||||||
(call-with-input-file
|
|
||||||
(string-append "../source/" script suffix)
|
|
||||||
(lambda (input)
|
|
||||||
(call-with-output-file (string-append bin script)
|
|
||||||
(lambda (output)
|
|
||||||
(format output "#!~a/bin/python3\n~a"
|
|
||||||
#$(this-package-input "python")
|
|
||||||
(get-string-all input))))))
|
|
||||||
(chmod (string-append bin script) #o555)))
|
|
||||||
(mkdir-p bin)
|
|
||||||
(make-script "convert_hf_to_gguf")
|
|
||||||
(make-script "convert_llama_ggml_to_gguf")
|
|
||||||
(make-script "convert_hf_to_gguf_update.py"))))
|
|
||||||
(add-after 'install-python-scripts 'wrap-python-scripts
|
|
||||||
(assoc-ref python:%standard-phases 'wrap))
|
(assoc-ref python:%standard-phases 'wrap))
|
||||||
(add-after 'install 'remove-tests
|
(add-after 'install 'remove-tests
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
|
@ -725,12 +711,13 @@ Performance is achieved by using the LLVM JIT compiler.")
|
||||||
(string-append (assoc-ref outputs "out")
|
(string-append (assoc-ref outputs "out")
|
||||||
"/bin")
|
"/bin")
|
||||||
"^test-")))))))
|
"^test-")))))))
|
||||||
(inputs (list python vulkan-headers vulkan-loader))
|
(inputs (list curl glslang python python-gguf-llama-cpp
|
||||||
(native-inputs (list pkg-config shaderc bash))
|
vulkan-headers vulkan-loader))
|
||||||
|
(native-inputs (list pkg-config shaderc bash-minimal))
|
||||||
(propagated-inputs
|
(propagated-inputs
|
||||||
(list python-numpy python-pytorch python-sentencepiece openblas))
|
(list python-numpy python-pytorch python-sentencepiece openblas))
|
||||||
(properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available
|
(properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available
|
||||||
(home-page "https://github.com/ggerganov/llama.cpp")
|
(home-page "https://github.com/ggml-org/llama.cpp")
|
||||||
(synopsis "Port of Facebook's LLaMA model in C/C++")
|
(synopsis "Port of Facebook's LLaMA model in C/C++")
|
||||||
(description "This package provides a port to Facebook's LLaMA collection
|
(description "This package provides a port to Facebook's LLaMA collection
|
||||||
of foundation language models. It requires models parameters to be downloaded
|
of foundation language models. It requires models parameters to be downloaded
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue