Skip to content

Instantly share code, notes, and snippets.

@oborchers
Created April 3, 2021 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oborchers/7e27033be3c7d53a43064c74c4dc4f1a to your computer and use it in GitHub Desktop.
Save oborchers/7e27033be3c7d53a43064c74c4dc4f1a to your computer and use it in GitHub Desktop.
apt-get update
# Install ONNX ML
export ONNX_ML=1
pip install -U onnx
# Clone ONNX Runtime and build
git clone https://github.com/microsoft/onnxruntime.git --branch v1.7.1 --single-branch
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh
cd onnxruntime/
pip install -r requirements-dev.txt
/bin/sh ./build.sh \
--config Release \
--update \
--build \
--build_wheel \
--parallel \
--use_cuda \
--cuda_home $CUDA_HOME \
--cudnn_home /usr/lib/x86_64-linux-gnu/ \
--use_tensorrt \
--tensorrt_home /opt/tensorrt/ \
--build_dir /workspace/onnxruntime/python
# Requires cmake > 3.17
pip install onnxruntime-tools git+https://github.com/microsoft/ort-customops.git
# Make sure some prior package did not accidentally overwrite the GPU install
pip uninstall -y onnxruntime && \
pip install -U /workspace/onnxruntime/python/Release/dist/*gpu*.whl
echo "ONNX Runtime Execution Providers: " && python -c "import onnxruntime as ort; print(ort.get_available_providers())"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment