mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
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
This commit is contained in:
parent
7720430678
commit
43c92f323e
3 changed files with 79 additions and 0 deletions
|
@ -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 \
|
||||
|
|
|
@ -1214,6 +1214,29 @@ (define args
|
|||
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++
|
||||
|
|
55
gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch
Normal file
55
gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch
Normal file
|
@ -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}
|
Loading…
Reference in a new issue