-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ONNX (v1.2.2) preset #547
ONNX (v1.2.2) preset #547
Changes from 42 commits
79076dd
3e2e5d9
37ec5fd
60fc3ac
3ea1303
f071d63
ed8103f
19df87c
51da3a9
8fb5ea9
2a711c4
9e99098
90c7f17
6eb8cb3
2c7829e
6657ac7
d2e3ba6
5e1e366
81fc397
97277b0
ea0a777
96ff7af
f807074
1b48fe3
6c8b0de
cdd3cf9
76a91f4
5d90c05
858bb58
be52a71
f504ed5
f56889f
332c93b
b738c56
742745b
4fd1d76
3dadeeb
3f71ef9
7e7bc95
b0ec9a1
b2299fc
9fad665
eb63f55
b1952cd
c3c2a61
765ad5e
7c5d20a
7f76f73
3f58a76
72b9f86
f03580f
b3d02fa
ef45c79
5825cc8
7689163
6a05a63
3198726
70caffc
93402b0
862477e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Open Neural Network Exchange | ||
|
||
Copyright (c) Facebook, Inc. and Microsoft Corporation. | ||
All rights reserved. | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- protobuf-2.6.1/autogen.sh 2014-10-20 20:06:06.000000000 -0400 | ||
+++ autogen.sh 2018-04-15 19:38:24.032970600 -0400 | ||
@@ -19,8 +19,9 @@ | ||
# directory is set up as an SVN external. | ||
if test ! -e gtest; then | ||
echo "Google Test not present. Fetching gtest-1.5.0 from the web..." | ||
- curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx | ||
- mv gtest-1.5.0 gtest | ||
+ wget https://github.com/google/googletest/archive/release-1.5.0.zip | ||
+ unzip release-1.5.0.zip | ||
+ mv googletest-release-1.5.0 gtest | ||
fi | ||
|
||
set -ex |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
# This file is meant to be included by the parent cppbuild.sh script | ||
if [[ -z "$PLATFORM" ]]; then | ||
pushd .. | ||
bash cppbuild.sh "$@" onnx | ||
popd | ||
exit | ||
fi | ||
|
||
if [[ $PLATFORM == windows* ]]; then | ||
#No Windows support yet | ||
: | ||
else | ||
|
||
export PROTO=2.6.1 | ||
export INSTALL_PATH=`pwd`/$PLATFORM | ||
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O ~/miniconda.sh | ||
bash ~/miniconda.sh -f -b -p $HOME/miniconda | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does Miniconda need to be installed in the $HOME directory? What happens if we place it in $INSTALL_PATH? |
||
export PATH="$HOME/miniconda/bin:$PATH" | ||
conda install -y -c conda-forge protobuf=2.6.1 numpy setuptools | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to create files in $HOME as hinted by the uninstallation procedure? |
||
export CFLAGS="-I$HOME/miniconda/include" | ||
export CONDA_PREFIX="$HOME/miniconda" | ||
wget https://github.com/onnx/onnx/archive/v1.0.1.tar.gz | ||
|
||
mkdir -p $PLATFORM | ||
cd $PLATFORM | ||
wget https://github.com/google/protobuf/archive/v$PROTO.tar.gz | ||
mv v$PROTO.tar.gz protobuf-$PROTO.tar.gz | ||
tar -xvf protobuf-$PROTO.tar.gz | ||
|
||
export LIBRARY_PATH=`pwd`/lib | ||
export PATH=$PATH:`pwd`/bin | ||
export CFLAGS="-I`pwd`/include" | ||
export CXXFLAGS="-I`pwd`/include" | ||
cd protobuf-$PROTO | ||
|
||
patch ./autogen.sh ../../../autogen.sh.patch | ||
./autogen.sh | ||
./configure "--prefix=$INSTALL_PATH" CFLAGS=-fPIC CXXFLAGS=-fPIC | ||
make -j `nproc` | ||
make install | ||
|
||
cd .. | ||
tar -xzvf ../v1.0.1.tar.gz | ||
cd onnx-1.0.1/third_party/pybind11 | ||
wget https://github.com/pybind/pybind11/archive/v2.2.1.tar.gz | ||
tar -xzvf v2.2.1.tar.gz | ||
mv pybind11-2.2.1/* . | ||
rm -r pybind11-2.2.1/ | ||
cd ../.. | ||
|
||
#to build with "Traditional ML" support. Untested. | ||
#export ONNX_ML=1 | ||
export BASEDIR=build/temp.linux-x86_64-2.7/`pwd`/onnx/ | ||
|
||
python setup.py install --single-version-externally-managed --record=record.txt | ||
g++ -v -std=c++11 -shared -Wl,-soname,libonnx.so -fPIC -o libonnx.so $BASEDIR/onnx-operators.pb.o $BASEDIR/onnx.pb.o $BASEDIR/checker.o $BASEDIR/defs/schema.o $BASEDIR/defs/tensor/old.o $BASEDIR/defs/tensor/defs.o $BASEDIR/defs/generator/defs.o $BASEDIR/defs/math/defs.o $BASEDIR/defs/data_type_utils.o $BASEDIR/defs/traditionalml/defs.o $BASEDIR/defs/experiments/defs.o $BASEDIR/defs/nn/defs.o $BASEDIR/defs/nn/old.o $BASEDIR/defs/reduction/defs.o $BASEDIR/defs/logical/defs.o $BASEDIR/defs/rnn/defs.o -pthread | ||
cd .. | ||
|
||
cd include | ||
mkdir defs | ||
mkdir onnx | ||
cd .. | ||
|
||
cp onnx-1.0.1/onnx/*.h include/onnx/ | ||
cp onnx-1.0.1/onnx/defs/*.h include/defs/ | ||
#TODO: Fix so the workaround isn't needed here | ||
#next line to workaround by commenting out parts of schema.h that cause failures | ||
patch include/defs/schema.h ../../schema.h.patch | ||
cp onnx-1.0.1/libonnx.so lib | ||
fi | ||
cd .. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>javacpp-presets</artifactId> | ||
<version>1.4.2-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.bytedeco.javacpp-presets</groupId> | ||
<artifactId>onnx</artifactId> | ||
<version>1.0.1-1.4.2-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>JavaCPP Presets for onnx</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>javacpp</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>javacpp</artifactId> | ||
<configuration> | ||
<compilerOptions> | ||
<compilerOption>-std=c++11</compilerOption> | ||
<compilerOption>-fpermissive</compilerOption> | ||
</compilerOptions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- cppbuild/linux-x86_64/onnx-1.0.1/onnx/defs/schema.h 2018-01-25 21:25:37.000000000 -0500 | ||
+++ schema.h 2018-04-07 10:36:14.887478089 -0400 | ||
@@ -311,6 +311,7 @@ | ||
|
||
// Type constraint. | ||
struct TypeConstraintParam { | ||
+ TypeConstraintParam(): description("default description") {} | ||
TypeConstraintParam( | ||
const std::string& type_param_str_, | ||
const std::vector<std::string>& allowed_type_strs_, | ||
@@ -389,6 +390,7 @@ | ||
int since_version() const { | ||
return since_version_; | ||
} | ||
+ | ||
const std::map<std::string, Attribute>& attributes() const { | ||
return attributes_; | ||
} | ||
@@ -427,9 +429,9 @@ | ||
int max_output() const { | ||
return max_output_; | ||
} | ||
- std::pair<UseType, int> consumed(int i) const { | ||
- return consumed_(i); | ||
- } | ||
+// std::pair<UseType, int> consumed(int i) const { | ||
+// return consumed_(i); | ||
+// } | ||
|
||
private: | ||
friend class OpSchemaRegistry; | ||
@@ -448,8 +450,10 @@ | ||
std::string doc_; | ||
// Default domain value ("") means it's ONNX domain. | ||
std::string domain_ = ""; | ||
+ | ||
std::map<std::string, Attribute> attributes_{}; | ||
bool allows_unchecked_attributes_ = false; | ||
+ | ||
std::vector<FormalParameter> inputs_; | ||
std::vector<FormalParameter> outputs_; | ||
std::vector<TypeConstraintParam> type_constraint_params_; | ||
@@ -577,9 +581,9 @@ | ||
} | ||
} | ||
|
||
- private: | ||
+// private: | ||
// OpSchemaRegistry should not need to be instantiated. | ||
- OpSchemaRegistry() = delete; | ||
+// OpSchemaRegistry() = delete; | ||
|
||
/** | ||
* @brief Returns the underlying string to OpSchema map. | ||
@@ -623,5 +627,5 @@ | ||
op_schema_register_once##name) = OpSchema(#name, __FILE__, __LINE__) | ||
|
||
// Helper function | ||
-size_t ReplaceAll(std::string& s, const char* from, const char* to); | ||
+//size_t ReplaceAll(std::string& s, const char* from, const char* to); | ||
} // namespace onnx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably fixed with recent versions of protobuf. Let's try to get that running maybe? Please show me the kind of errors you get with 3.5.x.