aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/machine-learning.scm
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2024-08-04 22:15:55 +0000
committerLudovic Courtès <ludo@gnu.org>2024-09-06 11:46:25 +0200
commit73302e3cae6284730878c887e355121aaaade799 (patch)
tree781ad47cf041bdc6e70e18c7d0d1e407b9f61c5d /gnu/packages/machine-learning.scm
parent595cc594b65ffe4a55c8b8d53a91a841cf056103 (diff)
downloadguix-73302e3cae6284730878c887e355121aaaade799.tar.gz
guix-73302e3cae6284730878c887e355121aaaade799.zip
gnu: onnx-optimizer: Update to 0.3.19.
* gnu/packages/machine-learning.scm (onnx-optimizer): Update to 0.3.19. * gnu/packages/patches/onnx-optimizer-system-library.patch: Adjust patch. Co-authored-by: Andy Tai <atai@atai.org>
Diffstat (limited to 'gnu/packages/machine-learning.scm')
-rw-r--r--gnu/packages/machine-learning.scm47
1 files changed, 36 insertions, 11 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 342289143f..1c5a095d8f 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1361,8 +1361,7 @@ in terms of new algorithms.")
(lambda* (#:key outputs tests? #:allow-other-keys)
;; For derived package use
(substitute* "CMakeLists.txt"
- (("set\\(ONNX_ROOT.*")
- (string-append "set(ONNX_ROOT "#$(package-source this-package) ")\n"))
+ (("set\\(ONNX_ROOT.*") "")
(("\\$\\{ROOT_DIR\\}(/tools.*)" _ rest)
(string-append "${PROJECT_SOURCE_DIR}" rest)))
;; Pass options to the CMake-based build process.
@@ -1382,14 +1381,15 @@ in terms of new algorithms.")
(string-append "-DONNX_BUILD_TESTS="
(if tests? "ON" "OFF"))
"-DBUILD_SHARED_LIBS=ON"
- "-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"))
+ "-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
+ (string-append
+ "-DONNX_ROOT=" #$(package-source this-package))))
;; This environment variable is honored by 'setup.py',
;; which passes it down to 'cmake'.
(setenv "CMAKE_ARGS" (string-join args))
- ;; This one is honored by 'setup.py' and passed to 'make
- ;; -j'.
+ ;; This one is honored by 'setup.py' and passed to 'make -j'.
(setenv "MAX_JOBS"
(number->string (parallel-job-count)))))
(add-before 'check 'make-test-directory-writable
@@ -1445,8 +1445,8 @@ operators and standard data types.")
(define-public onnx-optimizer
(package
(name "onnx-optimizer")
- ;; Note: 0.2.x is *more* recent than 1.5.0.
- (version "0.2.6")
+ ;; Note: 0.3.x is *more* recent than 1.5.0.
+ (version "0.3.19")
(home-page "https://github.com/onnx/optimizer")
(source (origin
(method git-fetch)
@@ -1455,7 +1455,7 @@ operators and standard data types.")
(commit (string-append "v" version))))
(sha256
(base32
- "1wkqqdxcxpfbf8zpbdfdd3zz5jkw775g31gyykj11z4y6pp659l6"))
+ "1mx3hsl42na6fr05nh2x3j9kxm56cpfmwk6lwl2cfq9zs3gv929w"))
(file-name (git-file-name name version))
(patches (search-patches "onnx-optimizer-system-library.patch"))
(modules '((guix build utils)))
@@ -1466,10 +1466,35 @@ operators and standard data types.")
(substitute-keyword-arguments (package-arguments onnx)
((#:phases phases)
#~(modify-phases #$phases
- (delete 'relax-requirements)))))
+ (add-after 'pass-cmake-arguments
+ 'pass-onnx-optimizer-cmake-arguments
+ (lambda _
+ (setenv
+ "CMAKE_ARGS"
+ (string-append
+ (getenv "CMAKE_ARGS")
+ " -DONNX_OPT_USE_SYSTEM_PROTOBUF=ON"
+ " -DCMAKE_CXX_FLAGS=\"-DONNX_ML=1 -DONNX_NAMESPACE=onnx\""))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (if tests?
+ (invoke "pytest" "-vv" "-k"
+ ;; These tests fail with upstream ONNX:
+ ;; https://github.com/onnx/optimizer/issues/138
+ (string-append
+ "not test_fuse_matmul"
+ " and not test_fuse_consecutive"
+ " and not test_fuse_transpose")))))))))
(native-inputs
- (list cmake python-pytest python-pytest-runner python-nbval
- python-coverage))
+ (append
+ (list cmake-minimal python-pytest python-pytest-runner
+ python-coverage)
+ (filter
+ (lambda (pkg)
+ (member (or (%current-target-system)
+ (%current-system))
+ (package-transitive-supported-systems pkg)))
+ (list python-nbval))))
(inputs
(list onnx protobuf pybind11))
(propagated-inputs