Package: guix-patches;
Reported by: Andy Tai <atai <at> atai.org>
Date: Wed, 10 Jul 2024 04:54:02 UTC
Severity: normal
Tags: patch
Done: dannym <at> friendly-machines.com
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Andy Tai <atai <at> atai.org> To: 72027 <at> debbugs.gnu.org Cc: Andy Tai <atai <at> atai.org> Subject: [bug#72027] [PATCH v11] gnu: Add whisper-cpp. Date: Thu, 28 Nov 2024 12:42:17 -0800
* gnu/packages/machine-learning.scm (whisper-cpp): New variable. * gnu/packages/patches/whisper-cpp-enable-tests.patch: New file. * gnu/local.mk: Register new file. Change-Id: I8db67dc543c0a1280e2cc5e8c03945b9ccdb9975 --- gnu/local.mk | 1 + gnu/packages/machine-learning.scm | 54 +++++++++++++++++++ .../patches/whisper-cpp-enable-tests.patch | 19 +++++++ 3 files changed, 74 insertions(+) create mode 100644 gnu/packages/patches/whisper-cpp-enable-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index c89fd88282..346ef2e0fb 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2327,6 +2327,7 @@ dist_patch_DATA = \ %D%/packages/patches/webrtc-audio-processing-x86-no-sse.patch \ %D%/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch \ %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch \ + %D%/packages/patches/whisper-cpp-enable-tests.patch \ %D%/packages/patches/wmctrl-64-fix.patch \ %D%/packages/patches/wmfire-dont-inline-draw-fire.patch \ %D%/packages/patches/wmfire-update-for-new-gdk-versions.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 3696a81ea6..69b3ac48fb 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -118,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) @@ -6067,6 +6068,59 @@ (define-public oneapi-dnnl-for-r-torch (sha256 (base32 "1zyw5rd8x346bb7gac9a7x3saviw3zvp6aqz2z1l9sv163vmjfz6")))))) +(define-public whisper-cpp + (package + (name "whisper-cpp") + (version "1.7.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 "0fbxf43dfz0wgc2qx57gm7a56nqpbmvkzgk68jfj1pa5r9qijzfb")) + (patches (search-patches "whisper-cpp-enable-tests.patch")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags #~'("-DWHISPER_STANDALONE=TRUE" "-DWHISPER_SDL2=TRUE" + "-DWHISPER_BUILD_TESTS=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") diff --git a/gnu/packages/patches/whisper-cpp-enable-tests.patch b/gnu/packages/patches/whisper-cpp-enable-tests.patch new file mode 100644 index 0000000000..c4340d4879 --- /dev/null +++ b/gnu/packages/patches/whisper-cpp-enable-tests.patch @@ -0,0 +1,19 @@ +Distribution specific patch + +restored tests commented out in CMakeLists.txt upstream + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c53252b..ee06015 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -176,8 +176,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/whisper.pc" + # + + if (WHISPER_BUILD_TESTS AND NOT CMAKE_JS_VERSION) +- #include(CTest) +- #add_subdirectory(tests) ++ include(CTest) ++ add_subdirectory(tests) + endif () + + if (WHISPER_BUILD_EXAMPLES) base-commit: ce877a777e6ec089dc347e9883387d3080b471cf -- 2.34.1
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.