diff options
Diffstat (limited to 'gnu/packages/machine-learning.scm')
-rw-r--r-- | gnu/packages/machine-learning.scm | 167 |
1 files changed, 120 insertions, 47 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 7ad25e80c6..4d8ff4b5e3 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -128,6 +128,7 @@ #:use-module (gnu packages python-science) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages qt) #:use-module (gnu packages rdf) #:use-module (gnu packages regex) #:use-module (gnu packages rocm) @@ -433,6 +434,42 @@ machine learning algorithms based on GPs.") (list python)) (synopsis "Python bindings of libSVM"))) +(define-public python-mcfit + ;; PyPI variant fails during compile-bytecode phase: "IndentationError: + ;; expected an indented block after function definition on line 10 + ;; (mkfit.py, line 15)". + ;; GitHub provides no release tags, use the latest commit from the master + ;; branch. + ;; See: <https://github.com/eelregit/mcfit/issues/5>. + (let ((commit "be3a5cf9c474e16875126adcd35ba785fb781ebb") + (revision "0")) + (package + (name "python-mcfit") + (version (git-version "0.0.22" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/eelregit/mcfit") + (commit commit))) + (sha256 + (base32 "120ybwhrqpn9a9q96m6l8pw8a7cdz705vzqn3s87wnffa8nslbsi")))) + (build-system pyproject-build-system) + (native-inputs + (list python-pytest + python-setuptools + python-wheel)) + (propagated-inputs + (list python-mpmath + python-numpy + python-scipy)) + (home-page "https://github.com/eelregit/mcfit") + (synopsis "Multiplicatively convolutional fast integral transforms") + (description + "This package provides multiplicatively convolutional fast integral +transforms.") + (license license:gpl3+)))) + (define-public python-ml-collections (package (name "python-ml-collections") @@ -646,7 +683,7 @@ Performance is achieved by using the LLVM JIT compiler.") (deprecated-package "guile-aiscm-next" guile-aiscm)) (define-public llama-cpp - (let ((tag "b5013")) + (let ((tag "b6056")) (package (name "llama-cpp") (version (string-append "0.0.0-" tag)) @@ -658,7 +695,7 @@ Performance is achieved by using the LLVM JIT compiler.") (commit tag))) (file-name (git-file-name name tag)) (sha256 - (base32 "0s73dz871x53dr366lkzq19f677bwgma2ri8m5vhbfa9p8yp4p3r")))) + (base32 "1y9blrd7c8snazjmjkzj0148v328pigncvf1l9g1ih735b67zpd0")))) (build-system cmake-build-system) (arguments (list @@ -693,11 +730,23 @@ Performance is achieved by using the LLVM JIT compiler.") #~(modify-phases %standard-phases (add-after 'unpack 'patch-paths (lambda* (#:key inputs #:allow-other-keys) - (substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp" - (("\"/bin/sh\"") - (string-append "\"" (search-input-file inputs "/bin/sh") "\""))))) + (substitute* (format #f "~a~a" + "ggml/src/ggml-vulkan/vulkan-shaders/" + "vulkan-shaders-gen.cpp") + (("\"/bin/sh\"") + (string-append "\"" (search-input-file inputs "/bin/sh") + "\""))))) (add-after 'unpack 'fix-tests (lambda _ + ;; test-thread-safety downloads ML model from network, + ;; cannot run in Guix build environment + (substitute* '("tests/CMakeLists.txt") + (("llama_build_and_test\\(test-thread-safety.cpp.*") + "") + ;; error while handling argument "-m": expected value for + ;; argument + (("llama_build_and_test\\(test-arg-parser.cpp.*") + "")) ;; test-eval-callback downloads ML model from network, cannot ;; run in Guix build environment (substitute* '("examples/eval-callback/CMakeLists.txt") @@ -730,7 +779,7 @@ independently to be able to run a LLaMA model.") (define-public whisper-cpp (package (name "whisper-cpp") - (version "1.7.5") + (version "1.7.6") (source (origin (method git-fetch) (uri (git-reference @@ -739,7 +788,7 @@ independently to be able to run a LLaMA model.") (file-name (git-file-name name version)) (sha256 (base32 - "0fs15rizz4psd3flfjpdivzvc9w19i3706flisn136ax0k8r7w5n")))) + "0gn64jw4pr4vfnn2hll7yd98r8yhaqg97hhg5z22vq4j423436kn")))) (build-system cmake-build-system) (arguments (list @@ -763,9 +812,15 @@ independently to be able to run a LLaMA model.") "-DGGML_AVX2=OFF" "-DGGML_AVX512=OFF" "-DGGML_AVX512_VBMI=OFF" - "-DGGML_AVX512_VNNI=OFF") + "-DGGML_AVX512_VNNI=OFF" + "-DGGML_VULKAN=ON") #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp" + (("\"/bin/sh\"") + (string-append "\"" (search-input-file inputs "/bin/sh") "\""))))) #$@(if (not (target-64bit?)) '((add-after 'unpack 'skip-failing-tests (lambda _ @@ -775,11 +830,21 @@ independently to be able to run a LLaMA model.") (substitute* "tests/CMakeLists.txt" (("LABELS \"large\"") "DISABLED true"))))) - '())))) + '()) + (add-after 'unpack 'skip-failing-vad-tests + (lambda _ + (substitute* "tests/CMakeLists.txt" + ;; error: failed to read audio data as wav (Unknown error) + (("\\$\\{VAD_TEST\\} PROPERTIES LABELS \"unit\"") + "${VAD_TEST} PROPERTIES DISABLED true") + ;; error: failed to read audio data as wav (Unknown error) + (("\\$\\{VAD_TARGET\\} PROPERTIES LABELS \"base;en\"") + "${VAD_TEST} PROPERTIES DISABLED true"))))))) (native-inputs - (list pkg-config)) + (list pkg-config shaderc)) (inputs - (list openblas sdl2 git)) + (list openblas sdl2 git spirv-headers spirv-tools + vulkan-headers vulkan-loader)) (synopsis "OpenAI's Whisper model in C/C++") (description "This package is a high-performance inference of OpenAI's @@ -797,7 +862,7 @@ without dependencies, with @item C-style API @end itemize") (properties '((tunable? . #true))) ;use AVX512, FMA, etc. when available - (home-page "https://github.com/ggerganov/whisper.cpp") + (home-page "https://github.com/ggml-org/whisper.cpp/") (license license:expat))) (define-public mcl @@ -4754,7 +4819,6 @@ TensorFlow.js, PyTorch, and MediaPipe.") (build-system cmake-build-system) (arguments (list - #:cmake cmake-next #:configure-flags ''("-DFBGEMM_LIBRARY_TYPE=shared") ;; Tests require AVX2 or AVX-512 instructions @@ -4823,7 +4887,6 @@ the tensors contained therein.") (build-system cmake-build-system) (arguments (list - #:test-target "cpptest" #:configure-flags #~(list "-DUSE_OPENCL=ON" "-DUSE_VULKAN=ON" @@ -4843,11 +4906,11 @@ the tensors contained therein.") #:phases #~(modify-phases %standard-phases (replace 'check - (lambda* (#:key source test-target tests? #:allow-other-keys) + (lambda* (#:key source tests? #:allow-other-keys) (when tests? (begin (invoke "make" "-j" - (number->string (parallel-job-count)) test-target) + (number->string (parallel-job-count)) "cpptest") ;; Disable below the actual run of the tests because ;; several fail due to platform variations (for example, ;; fp16 tests fail because not supported on CPUs). @@ -5143,6 +5206,10 @@ PyTorch.") (substitute* "aten/src/ATen/native/vulkan/api/Allocator.h" (("<include/vk_mem_alloc.h>") "<vk_mem_alloc.h>")) + ;; Fix missing <algorithm> header for std::for_each in Vulkan API + (substitute* "aten/src/ATen/native/vulkan/api/QueryPool.cpp" + (("#include <utility>" all) + (string-append all "\n#include <algorithm>"))) ;; For Vulkan (substitute* "CMakeLists.txt" (("append_cxx_flag.*-Werror=(return-type|range-loop-construct).*") "")) @@ -6315,7 +6382,6 @@ Jax, PyTorch and TensorFlow — with a seamless integration between them.") (build-system cmake-build-system) (arguments (list - #:test-target "ctranslate2_test" ;; XXX: mkl and openblas seem incompatible. #:configure-flags `(list "-DBUILD_TESTS=ON" "-DWITH_ACCELERATE=OFF" @@ -6324,7 +6390,16 @@ Jax, PyTorch and TensorFlow — with a seamless integration between them.") "-DWITH_CUDA=OFF" "-DWITH_CUDNN=OFF" "-DWITH_MKL=OFF" - "-DWITH_OPENBLAS=ON"))) + "-DWITH_OPENBLAS=ON") + #:modules '((guix build cmake-build-system) + ((guix build gnu-build-system) #:prefix gnu:) + (guix build utils)) + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:rest args) + (apply (assoc-ref gnu:%standard-phases 'check) + #:test-target "ctranslate2_test" args)))))) (native-inputs (list libomp cxxopts spdlog @@ -7072,35 +7147,33 @@ performance library of basic building blocks for deep learning applications.") (base32 "1zyw5rd8x346bb7gac9a7x3saviw3zvp6aqz2z1l9sv163vmjfz6")))))) (define-public python-gguf - ;; They didn't tag the commit - (let ((commit "69050a11be0ae3e01329f11371ecb6850bdaded5")) - (package - (name "python-gguf") - (version "0.16.0") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/ggml-org/llama.cpp") - (commit commit))) - (file-name (git-file-name name commit)) - (sha256 - (base32 "1563mbrjykwpsbhghhzi4h1qv9qy74gq5vq4xhs58zk0jp20c7zz")))) - (build-system pyproject-build-system) - (arguments - (list - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'chdir - (lambda _ - (chdir "gguf-py")))))) - (propagated-inputs (list python-numpy python-pyyaml python-sentencepiece - python-tqdm)) - (native-inputs (list python-poetry-core python-pytest)) - (home-page "https://ggml.ai") - (synopsis "Read and write ML models in GGUF for GGML") - (description "A Python library for reading and writing GGUF & GGML format ML models.") - (license license:expat)))) + (package + (name "python-gguf") + (version "0.17.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ggml-org/llama.cpp") + (commit (string-append "gguf-v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0lrvj0ahhyj5paxfzk0brps2m8j7fy47n7k4v4xjg9xqqq6wqc2y")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + (chdir "gguf-py")))))) + (propagated-inputs (list python-numpy python-pyyaml python-pyside-6 + python-sentencepiece python-tqdm)) + (native-inputs (list python-poetry-core python-pytest)) + (home-page "https://ggml.ai") + (synopsis "Read and write ML models in GGUF for GGML") + (description "A Python library for reading and writing GGUF & GGML format ML models.") + (license license:expat))) (define-public python-gymnasium (package |