guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#72027] [PATCH v7] gnu: Add whisper-cpp.


From: Andy Tai
Subject: [bug#72027] [PATCH v7] gnu: Add whisper-cpp.
Date: Wed, 28 Aug 2024 21:06:41 -0700

* gnu/packages/machine-learning.scm (whisper-cpp): New variable.

Change-Id: If191f434a3f66b16afdc702069eaed1ca22e2427
---
 gnu/packages/machine-learning.scm | 54 +++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/machine-learning.scm 
b/gnu/packages/machine-learning.scm
index 4c5b713cbf..bad7033894 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2024 Timothee Mathieu <timothee.mathieu@inria.fr>
 ;;; Copyright © 2024 Spencer King <spencer.king@geneoscopy.com>
 ;;; Copyright © 2024 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2024 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -117,6 +118,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages regex)
   #:use-module (gnu packages rpc)
+  #:use-module (gnu packages sdl)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages statistics)
@@ -5937,6 +5939,58 @@ (define-public oneapi-dnnl-for-r-torch
        (sha256
         (base32 "1zyw5rd8x346bb7gac9a7x3saviw3zvp6aqz2z1l9sv163vmjfz6"))))))
 
+(define-public whisper-cpp
+  (package
+    (name "whisper-cpp")
+    (version "1.6.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ggerganov/whisper.cpp";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "01q4j602wkvsf9vw0nsazzgvjppf4fhpy90vqnm9affynyxhi0c4"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags #~'("-DWHISPER_STANDALONE=TRUE" "-DWHISPER_SDL2=TRUE")
+      ;; "-DWHISPER_FFMPEG=TRUE"  ; TODO
+      #:phases #~(modify-phases %standard-phases
+           #$@(if (not (target-64bit?))
+                  '((add-after 'unpack 'skip-failing-tests
+                     (lambda _
+                              ;; 32-bit system
+                              ;; large model does not fit in RAM in 32-bit 
system,
+                              ;; disable large model test
+                              (substitute* "tests/CMakeLists.txt"
+                                  (("LABELS \"large\"")
+                                   "DISABLED true")))))
+                  '()))))
+    (inputs (list sdl2)) ;ffmpeg openblas  ;TODO:
+    (native-inputs (list pkg-config))
+    (properties '((tunable? . #t))) ;use AVX512, FMA, etc. when available
+    (home-page "https://github.com/ggerganov/whisper.cpp";)
+    (synopsis "OpenAI's Whisper model in C/C++")
+    (description
+     "This package is a high-performance inference of OpenAI's
+Whisper automatic speech recognition (ASR) model, implemented in plain C/C++
+without dependencies, with
+@itemize
+@item AVX intrinsics support for x86 architectures
+@item VSX intrinsics support for POWER architectures
+@item Mixed F16 / F32 precision
+@item 4-bit and 5-bit integer quantization support
+@item Zero memory allocations at runtime
+@item Support for CPU-only inference
+@item Efficient GPU support for NVIDIA
+@item OpenVINO Support
+@item C-style API
+@end itemize")
+    (license license:expat)))
+
+
 (define-public python-gguf
   (package
     (name "python-gguf")

base-commit: de25a21433bf8ac213302c52789af06a37f4f972
-- 
2.34.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]