-
Notifications
You must be signed in to change notification settings - Fork 106
Upgrade to onnx 1.9 #847
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
Merged
Merged
Upgrade to onnx 1.9 #847
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
33e6ef5
jetson 1.8
chayim b101e59
1.8 in the Makefile
chayim be2a69d
starting single use
chayim ddb2111
splitting a backend
chayim 68fdfc7
onnx 1.8 64-bit linux, 64-bit linux with gpu, and jetson
chayim 1136450
split up onnx to use docker library parts
chayim fffa1ea
pr comments
chayim bbfde5b
pr comments
chayim af40e81
Merge remote-tracking branch 'origin/master' into ck-onnx-1.8
chayim 8743a75
merge Chayim PR for building onnx
alonre24 1444119
WIP
alonre24 c8e49a9
Merge branch 'master' into upgrade_to_onnx_1.9
alonre24 c56aa85
remove temporarily the custom allocator support
alonre24 bab06d3
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 d1c5e80
xenial onnx 1.9 build using the template
chayim 08e8ef9
fixing python
chayim 63a318d
build onnx + test building with DISABLE_EXTERNAL_INITIALIZERS flag
alonre24 724319b
Add the model with the external initializer
alonre24 c9b82a3
Variablizing CUDA support
chayim 1aa4836
use new key for deps cache
alonre24 f312541
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 2977098
gcc due to glibc versioning
chayim 728b6b9
s/bionic/buster/ is back
chayim 2b1f0bd
update deps cache key to v1.2.5
alonre24 8b4e718
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 24f7ea9
PR comments
chayim 063b86a
PR fixes - documentation
alonre24 1b3ac61
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 74bf607
venv docs update
chayim 3e54ea2
get caller position when assertion fails in an auxiliary file
alonre24 7d31242
Return filename instead of function name
alonre24 c45934a
More PR fixes
alonre24 af1bcf8
merge add tests utility
alonre24 de4c368
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 8958a0d
Merge branch 'master' into upgrade_to_onnx_1.9
alonre24 55022ef
Build onnx with DISABLE_EXTERNAL_INITIALIZERS flag for GPU as well
alonre24 b18ecec
Merge branch 'master' into upgrade_to_onnx_1.9
alonre24 696747c
Merge branch 'upgrade_to_onnx_1.9' of https://github.com/RedisAI/Redi…
alonre24 f63f95f
update deps cache key in CI after rebuilding and publishing for gpu
alonre24 ab20006
ignore overlap valgrind errors from onnx lib
alonre24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# RedisAI Development Backends | ||
|
||
This document describes how a backend for RedisAI can be built, from this repository. It highlights the supported compilation devices on a per-backend basis, and highlights the tools and commands required. Unless indicated otherwise, a backend is compiled in a docker, which is responsible for the configuration and installation of all tools required for a given backend on a per-platform basis. | ||
|
||
To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/redisai/redisai*) | ||
|
||
GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the directory of a given backend listed below. | ||
|
||
## Tools | ||
|
||
Building the backends requires installation of the following tools: | ||
|
||
1. gnu make | ||
1. python (3.0 or higher) | ||
1. docker | ||
1. jinja2 | ||
|
||
On ubuntu bionic these can be installed by running the following steps, to install python3, create a virtual environment, and install the jinja templating dependency. Replace */path/to/venv* with your desired virtualenv location. | ||
|
||
``` | ||
sudo apt install python3 python3-dev make docker | ||
python3 -m venv /path/to/venv | ||
source /path/to/venv/bin/activate | ||
pip install jinja | ||
``` | ||
|
||
------- | ||
|
||
## Backends | ||
|
||
### onnxruntime | ||
|
||
We build Onnxruntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case. | ||
|
||
**Compilation target devices:** | ||
|
||
1. x86\_64 bit linux systems | ||
|
||
1. x86\_64 bit linux systems with a GPU | ||
|
||
**Directory:** opt/build/onnxruntime | ||
|
||
**Build options:** | ||
|
||
1. To build run *make* | ||
|
||
1. To build with GPU support on x86\_64 run *make GPU=1* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# PRODUCT var is the backend name, without any other configuration (set in each backend's corresponding makefile) | ||
|
||
# default is x64 | ||
alonre24 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ARCH=$(shell ${READIES}/bin/platform --arch) | ||
OS=$(shell ${READIES}/bin/platform --os) | ||
REDIS_CMAKE_ARCH=x86_64 | ||
DOCKER_ORG=redislabs | ||
|
||
# jetson | ||
ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes) | ||
ARCH=jetson | ||
REDIS_CMAKE_ARCH=aarch64 | ||
GPU=1 | ||
endif | ||
export REDIS_CMAKE_ARCH | ||
|
||
# override if necessary in top-level make files | ||
DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build | ||
CIDFILE=${PRODUCT}.${ARCH}.cid | ||
|
||
ifeq ($(GPU),1) | ||
REDIS_GPU=1 | ||
VARIANT=gpu | ||
CIDFILE=${PRODUCT}.${ARCH}.gpu.cid # this way we can build from the same tree across platforms | ||
export REDIS_GPU | ||
endif | ||
|
||
ifeq ($(VARIANT),) | ||
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz | ||
else | ||
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz | ||
endif | ||
|
||
S3_URL=redismodules/${PRODUCT} | ||
|
||
build: | ||
@rm -f ${BACKEND_NAME} *.cid | ||
REDIS_ARCH=${ARCH} \ | ||
REDIS_OSNICK=${OSNICK} \ | ||
${READIES}/bin/dockerwrapper \ | ||
-d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \ | ||
-t ${DEFAULT_DOCKER_TAG} \ | ||
-S ../dockerparts \ | ||
-e REDIS \ | ||
-D "${DOCKER_OPTS}" \ | ||
${DOCKER_ARGS} | ||
docker create --cidfile ${CIDFILE} ${DEFAULT_DOCKER_TAG} | ||
docker cp `cat ${CIDFILE}`:/build/${BACKEND_NAME} . | ||
|
||
publish: | ||
@aws s3 cp ${BACKEND_NAME} s3://$(S3_URL)/ --acl public-read | ||
|
||
# --------------------------------------------------------------------------------------------------- | ||
define HELP | ||
make build> # build the backend, tagging the docker image so that the files can be copied out of it | ||
OSNICK=<> # optional base operating system (xenial, bionic, etc) | ||
REDIS_CUDA_VERSION=<> # optional cuda version to override | ||
DOCKER_SUFFIX=<> # optional suffix for the generated dockerfile | ||
GPU=1 # if set, build the GPU | ||
make publish > # upload the generated artifacts to s3 same | ||
GPU=1 # if set, upload the GPU artifact (defaults to cpu) | ||
endef | ||
# --------------------------------------------------------------------------------------------------- | ||
include ${READIES}/mk/help.defs | ||
include ${READIES}/mk/help.rules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
RUN apt-get update -qq | ||
RUN DEBIAN_NONINTERACTIVE=y1 apt-get install -y software-properties-common | ||
|
||
{% if REDIS_OSNICK == 'xenial' %} | ||
RUN add-apt-repository ppa:deadsnakes/ppa | ||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test | ||
{% endif %} | ||
|
||
RUN apt-get update -qq | ||
RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ | ||
build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ | ||
python3.7 python3-pip python3-dev python3-numpy \ | ||
gcc-7 g++-7 | ||
|
||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 60 | ||
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 | ||
|
||
RUN python3 -m pip install --upgrade pip setuptools wheel | ||
|
||
ENV LANG=en_US.UTF-8 | ||
RUN apt-get install -y locales && \ | ||
sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ | ||
dpkg-reconfigure --frontend=noninteractive locales && \ | ||
update-locale LANG=$LANG | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% set cmake_version = "3.19.7" %} | ||
RUN wget -q https://github.com/Kitware/CMake/releases/download/v{{cmake_version}}/cmake-{{cmake_version}}-Linux-{{REDIS_CMAKE_ARCH}}.tar.gz -O /tmp/cmake.tgz | ||
|
||
WORKDIR /tmp | ||
RUN tar -zxpf /tmp/cmake.tgz | ||
RUN mv /tmp/cmake*/bin/* /usr/bin | ||
RUN mv /tmp/cmake-*/share/cmake* /usr/share/ | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Dockerfile | ||
onnxruntime.x64.cid |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why "a backend"?
we build only ONNXRuntime
maybe explain the need for building a backend. First, start with explaining that we use
DISABLE_EXTERNAL_INITIALIZERS=ON
and that made go and building the backend from the source. Also, explain that we do not build the other backend libraries but downloading their binaries from the library websites.When we need to add more "backend builds" we can add additional "how-to"s
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.
OK, I understand. I that OK if I will make the rephrasing in the next PR (#806 - the one that updates Torch and TF)?