[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/70: gnu: Add onnx-for-torch2.
From: |
guix-commits |
Subject: |
06/70: gnu: Add onnx-for-torch2. |
Date: |
Thu, 28 Dec 2023 03:35:42 -0500 (EST) |
rekado pushed a commit to branch r-updates
in repository guix.
commit dcc5a531da4926fb7267c406dc208b5d290c6b42
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Wed Dec 27 16:13:30 2023 +0100
gnu: Add onnx-for-torch2.
* gnu/packages/machine-learning.scm (onnx-for-torch2): New variable.
* gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Change-Id: I8a46b9a8096a33bcf949bc4f5d497e22902ab301
---
gnu/local.mk | 1 +
gnu/packages/machine-learning.scm | 23 +++++++++
.../onnx-1.13.1-use-system-googletest.patch | 55 ++++++++++++++++++++++
3 files changed, 79 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7dd3305041..3c4cea80e4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1720,6 +1720,7 @@ dist_patch_DATA =
\
%D%/packages/patches/online-judge-tools.patch \
%D%/packages/patches/onnx-optimizer-system-library.patch \
%D%/packages/patches/onnx-use-system-googletest.patch \
+ %D%/packages/patches/onnx-1.13.1-use-system-googletest.patch \
%D%/packages/patches/onnx-shared-libraries.patch \
%D%/packages/patches/onnx-skip-model-downloads.patch \
%D%/packages/patches/openbios-aarch64-riscv64-support.patch \
diff --git a/gnu/packages/machine-learning.scm
b/gnu/packages/machine-learning.scm
index c27b4b394b..bef4d62163 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1214,6 +1214,29 @@ an extensible computation graph model, as well as
definitions of built-in
operators and standard data types.")
(license license:expat)))
+(define-public onnx-for-torch2
+ (package
+ (inherit onnx)
+ (name "onnx")
+ (version "1.13.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/onnx/onnx")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "16967dbq2j40diqd0s37r19llsab8q8vbxkg1ppgy0p9fpdhfhyp"))
+ (file-name (git-file-name name version))
+ (patches (search-patches
"onnx-1.13.1-use-system-googletest.patch"
+ "onnx-shared-libraries.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ (delete-file-recursively "third_party")
+ (substitute* "onnx/backend/test/runner/__init__.py"
+ (("urlretrieve\\(.*") "raise unittest.SkipTest('Skipping
download')\n"))))))))
+
(define-public python-onnx
;; This used to be called "python-onnx" because it provided nothing but
;; Python bindings. The package now provides shared libraries and C++
diff --git a/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch
b/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch
new file mode 100644
index 0000000000..b6a5e5d828
--- /dev/null
+++ b/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch
@@ -0,0 +1,55 @@
+ONNX will build googletest from a Git checkout. Patch CMake to use our
+googletest package and enable tests by default.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0aa9fda2..a573170c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF)
+ option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON)
+ option(ONNX_WERROR "Build with Werror" OFF)
+ option(ONNX_COVERAGE "Build with coverage instrumentation" OFF)
+-option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF)
++option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON)
+ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
+ option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF)
+ if(NOT DEFINED ONNX_ML)
+@@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ endif()
+
+ if(ONNX_BUILD_TESTS)
+- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external)
+- include(googletest)
++ find_package(GTest REQUIRED)
++ if(NOT GTest_FOUND)
++ message(FATAL_ERROR "cannot find googletest")
++ endif()
+ endif()
+
+ if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT
ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
+diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake
+index e29a93ff..ae146390 100644
+--- a/cmake/unittest.cmake
++++ b/cmake/unittest.cmake
+@@ -7,7 +7,7 @@
+
+ find_package(Threads)
+
+-set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES})
++set(${UT_NAME}_libs ${GTEST_LIBRARIES})
+
+ list(APPEND ${UT_NAME}_libs onnx)
+ list(APPEND ${UT_NAME}_libs onnx_proto)
+@@ -22,9 +22,9 @@
+ list(REMOVE_DUPLICATES _UT_SOURCES)
+
+ add_executable(${_UT_TARGET} ${_UT_SOURCES})
+- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest)
++ add_dependencies(${_UT_TARGET} onnx onnx_proto)
+
+ target_include_directories(${_UT_TARGET}
+- PUBLIC ${googletest_INCLUDE_DIRS}
++ PUBLIC ${GTEST_INCLUDE_DIRS}
+ ${ONNX_INCLUDE_DIRS}
+ ${PROTOBUF_INCLUDE_DIRS}
+ ${ONNX_ROOT}
\ No newline at end of file
- 05/70: gnu: python-protobuf: Update to 3.20.2., (continued)
- 05/70: gnu: python-protobuf: Update to 3.20.2., guix-commits, 2023/12/28
- 10/70: gnu: r-torch: Update to 0.12.0., guix-commits, 2023/12/28
- 09/70: gnu: liblantern: Update to 0.11.0-1.4d83bd0., guix-commits, 2023/12/28
- 11/70: gnu: r-shiny: Update to 1.8.0., guix-commits, 2023/12/28
- 23/70: gnu: r-timedate: Update to 4032.109., guix-commits, 2023/12/28
- 20/70: gnu: r-maps: Update to 3.4.2., guix-commits, 2023/12/28
- 16/70: gnu: r-aod: Update to 1.3.3., guix-commits, 2023/12/28
- 14/70: gnu: r-ggvenndiagram: Update to 1.4.9., guix-commits, 2023/12/28
- 26/70: gnu: r-ucminf: Update to 1.2.1., guix-commits, 2023/12/28
- 08/70: gnu: python-pytorch-for-r-torch: Update to 2.0.1., guix-commits, 2023/12/28
- 06/70: gnu: Add onnx-for-torch2.,
guix-commits <=
- 28/70: gnu: r-timeseries: Update to 4032.108., guix-commits, 2023/12/28
- 07/70: gnu: Add onnx-optimizer-for-torch2., guix-commits, 2023/12/28
- 12/70: gnu: r-radiant-data: Update to 1.6.3., guix-commits, 2023/12/28
- 19/70: gnu: r-servr: Update to 0.28., guix-commits, 2023/12/28
- 17/70: gnu: r-datawizard: Update to 0.9.1., guix-commits, 2023/12/28
- 25/70: gnu: r-recipes: Update to 1.0.9., guix-commits, 2023/12/28
- 13/70: gnu: r-diversitree: Update to 0.10-0., guix-commits, 2023/12/28
- 33/70: gnu: r-targets: Update to 1.4.0., guix-commits, 2023/12/28
- 47/70: gnu: r-sf: Update to 1.0-15., guix-commits, 2023/12/28
- 37/70: gnu: r-tmb: Update to 1.9.10., guix-commits, 2023/12/28