[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
161/244: gnu: Add llama-cpp.
From: |
guix-commits |
Subject: |
161/244: gnu: Add llama-cpp. |
Date: |
Wed, 12 Apr 2023 08:49:13 -0400 (EDT) |
apteryx pushed a commit to branch staging
in repository guix.
commit aba9860bf8e5b92743b6025f72318843a5f95e99
Author: Nicolas Graves <ngraves@ngraves.fr>
AuthorDate: Sat Mar 25 16:32:20 2023 +0100
gnu: Add llama-cpp.
* gnu/packages/machine-learning.scm (llama-cpp): New variable.
Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
---
gnu/packages/machine-learning.scm | 64 +++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/gnu/packages/machine-learning.scm
b/gnu/packages/machine-learning.scm
index 402a8226b5..70319238d9 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -400,6 +400,70 @@ Performance is achieved by using the LLVM JIT compiler.")
(define-public guile-aiscm-next
(deprecated-package "guile-aiscm-next" guile-aiscm))
+(define-public llama-cpp
+ (let ((commit "3cd8dde0d1357b7f11bdd25c45d5bf5e97e284a0")
+ (revision "0"))
+ (package
+ (name "llama-cpp")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ggerganov/llama.cpp")
+ (commit (string-append "master-" (string-take commit 7)))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0i7c92cxqs31xklrn688978kk29agivgxjgvsb45wzm65gc6hm5c"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #: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-before 'install 'install-python-scripts
+ (lambda _
+ (let ((bin (string-append #$output "/bin/")))
+ (define (make-script script)
+ (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-pth-to-ggml")
+ (make-script "convert-gptq-to-ggml")
+ (make-script "quantize.py")
+ (substitute* (string-append bin "quantize.py")
+ (("os\\.getcwd\\(\\), quantize_script_binary")
+ (string-append "\"" bin "\", quantize_script_binary"))))))
+ (add-after 'install-python-scripts 'wrap-python-scripts
+ (assoc-ref python:%standard-phases 'wrap))
+ (replace 'install
+ (lambda _
+ (let ((bin (string-append #$output "/bin/")))
+ (install-file "bin/quantize" bin)
+ (copy-file "bin/main" (string-append bin "llama"))))))))
+ (inputs (list python))
+ (propagated-inputs
+ (list python-numpy python-pytorch python-sentencepiece))
+ (home-page "https://github.com/ggerganov/llama.cpp")
+ (synopsis "Port of Facebook's LLaMA model in C/C++")
+ (description "This package provides a port to Facebook's LLaMA collection
+of foundation language models. It requires models parameters to be downloaded
+independently to be able to run a LLaMA model.")
+ (license license:expat))))
+
(define-public mcl
(package
(name "mcl")
- 130/244: news: Add entry for 'guix shell --container --nesting'., (continued)
- 130/244: news: Add entry for 'guix shell --container --nesting'., guix-commits, 2023/04/12
- 132/244: gnu: linux-libre 6.1: Update to 6.1.23., guix-commits, 2023/04/12
- 148/244: services: desktop: Remove 'gnome-desktop-service' procedure., guix-commits, 2023/04/12
- 146/244: services: base: Remove 'console-font-service' procedure., guix-commits, 2023/04/12
- 144/244: services: sddm: Remove 'sddm-service' procedure., guix-commits, 2023/04/12
- 149/244: services: desktop: Remove 'mate-desktop-service' procedure., guix-commits, 2023/04/12
- 147/244: services: guix-publish: Remove 'compression-level' field., guix-commits, 2023/04/12
- 152/244: gnu: Add libpanel., guix-commits, 2023/04/12
- 212/244: gnu: open-adventure: Update to 1.15., guix-commits, 2023/04/12
- 232/244: status: Guard against a numerical overflow condition., guix-commits, 2023/04/12
- 161/244: gnu: Add llama-cpp.,
guix-commits <=
- 197/244: gnu: xfce4-clipman-plugin: Update to 1.6.3., guix-commits, 2023/04/12
- 171/244: gnu: ruby-pg: Update to 1.4.6., guix-commits, 2023/04/12
- 162/244: gnu: Add emacs-gptel., guix-commits, 2023/04/12
- 219/244: gnu: s6-dns: Update to 2.3.5.5., guix-commits, 2023/04/12
- 214/244: gnu: Add libxisf., guix-commits, 2023/04/12
- 206/244: gnu: emacs-treemacs-extra: Improve package style., guix-commits, 2023/04/12
- 222/244: gnu: s6-portable-utils: Update to 2.3.0.2., guix-commits, 2023/04/12
- 169/244: gnu: darktable: Update to 4.2.1., guix-commits, 2023/04/12
- 200/244: gnu: thunar-archive-plugin: Update to 0.5.1., guix-commits, 2023/04/12
- 202/244: gnu: xfce4-notifyd: Update to 0.8.2., guix-commits, 2023/04/12