diff options
Diffstat (limited to 'epistemia')
| -rw-r--r-- | epistemia/packages/machine-learning.scm | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/epistemia/packages/machine-learning.scm b/epistemia/packages/machine-learning.scm new file mode 100644 index 0000000..b3e121b --- /dev/null +++ b/epistemia/packages/machine-learning.scm | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | (define-module (epistemia packages machine-learning) | ||
| 2 | #:use-module (guix packages) | ||
| 3 | #:use-module (guix download) | ||
| 4 | #:use-module (guix utils) | ||
| 5 | #:use-module (guix git-download) | ||
| 6 | #:use-module (guix gexp) | ||
| 7 | #:use-module (gnu packages llvm) | ||
| 8 | #:use-module (gnu packages machine-learning) | ||
| 9 | #:use-module (gnu packages rocm) | ||
| 10 | #:use-module (gnu packages rocm-libs)) | ||
| 11 | |||
| 12 | (define-public llama-cpp-rocm | ||
| 13 | (let ((tag "b8931")) | ||
| 14 | (package | ||
| 15 | (inherit llama-cpp) | ||
| 16 | (name "llama-cpp-rocm") | ||
| 17 | (version (string-append "0.0.0-" tag)) | ||
| 18 | (source | ||
| 19 | (origin | ||
| 20 | (method git-fetch) | ||
| 21 | (uri (git-reference | ||
| 22 | (url "https://github.com/ggml-org/llama.cpp") | ||
| 23 | (commit tag))) | ||
| 24 | (file-name (git-file-name name tag)) | ||
| 25 | (sha256 | ||
| 26 | (base32 "1bjhkmgj83z5br70j4pgz1sa1jvbc4rmxm7kca2yr4f6wxk47sgx")))) | ||
| 27 | (arguments | ||
| 28 | (substitute-keyword-arguments (package-arguments llama-cpp) | ||
| 29 | ((#:configure-flags flags #~'()) | ||
| 30 | #~(append #$flags | ||
| 31 | '(;; CMAKE_HIP_FLAGS is to workaround regression in ROCm 7.2 | ||
| 32 | "-DCMAKE_HIP_FLAGS=\"-mllvm --amdgpu-unroll-threshold-local=600\"" | ||
| 33 | "-DGPU_TARGETS=gfx1100"))) | ||
| 34 | ((#:phases phases) | ||
| 35 | #~(modify-phases #$phases | ||
| 36 | ;; the test-chat test got two new extra lines that need to be removed | ||
| 37 | (add-after 'fix-tests 'fix-tests-new | ||
| 38 | (lambda _ | ||
| 39 | (substitute* "tests/CMakeLists.txt" | ||
| 40 | (("target_include_directories\\(test-chat PRIVATE.*") | ||
| 41 | "") | ||
| 42 | (("target_link_libraries\\(test-chat PRIVATE.*") | ||
| 43 | "")))))))) | ||
| 44 | (inputs | ||
| 45 | (modify-inputs (package-inputs llama-cpp) | ||
| 46 | (replace "ggml" ggml-rocm)))))) | ||
| 47 | |||
| 48 | (define-public ggml-rocm | ||
| 49 | (package | ||
| 50 | (inherit (@@ (gnu packages machine-learning) ggml)) | ||
| 51 | (name "ggml-rocm") | ||
| 52 | (version "0.10.0") | ||
| 53 | (source | ||
| 54 | (origin | ||
| 55 | (method git-fetch) | ||
| 56 | (uri (git-reference | ||
| 57 | (url "https://github.com/ggml-org/ggml") | ||
| 58 | (commit (string-append "v" version)))) | ||
| 59 | (file-name (git-file-name name version)) | ||
| 60 | (sha256 | ||
| 61 | (base32 "0pp3zsv5rckb4rr6ddd3d1qmpmg7ifzx46v932i5dndfaa8bp2yr")))) | ||
| 62 | (arguments | ||
| 63 | (substitute-keyword-arguments (package-arguments (@@ (gnu packages machine-learning) ggml)) | ||
| 64 | ((#:configure-flags flags #~'()) | ||
| 65 | #~(append #$flags (list (string-append "-DCMAKE_HIP_COMPILER_ROCM_ROOT=" #$rocm-hip-runtime) | ||
| 66 | (string-append "-DCMAKE_HIP_FLAGS=--rocm-path=" #$rocm-hip-runtime | ||
| 67 | " --rocm-device-lib-path=" #$rocm-device-libs "/amdgcn/bitcode") | ||
| 68 | "-DGPU_TARGETS=gfx1100" | ||
| 69 | "-DGGML_HIP=ON" | ||
| 70 | "-DGGML_HIP_ROCWMMA_FATTN=OFF" | ||
| 71 | "-DGGML_CUDA_FA_ALL_QUANTS=ON"))))) | ||
| 72 | (inputs | ||
| 73 | (modify-inputs (package-inputs (@@ (gnu packages machine-learning) ggml)) | ||
| 74 | (append clang-rocm | ||
| 75 | lld-rocm | ||
| 76 | rocm-cmake | ||
| 77 | rocm-device-libs | ||
| 78 | rocm-hipcc | ||
| 79 | rocm-hip-runtime | ||
| 80 | rocr-runtime | ||
| 81 | hipblas | ||
| 82 | hipblas-common | ||
| 83 | rocblas))))) | ||
