Skip to content
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

Add ONNX Runtime to ML Images #12

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitlab-ci/ml-variations/.onnx-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variables:
ONNX_RUNTIME_VERSION: ${_ONNX_RUNTIME_VERSION}
1 change: 1 addition & 0 deletions .gitlab-ci/ml-variations/.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ stages:
--build-arg ROS_BUILD_FROM_SRC=$ROS_BUILD_FROM_SRC
--build-arg TORCH_VERSION=$TORCH_VERSION
--build-arg TF_VERSION=$TF_VERSION
--build-arg ONNX_RUNTIME_VERSION=$ONNX_RUNTIME_VERSION
--build-arg TRITON_VERSION=$TRITON_VERSION
--tag $IMAGE .

Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci/ml-variations/ros-ml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include:
- .gitlab-ci/ml-variations/.torch.yml
- .gitlab-ci/ml-variations/.tf.yml
- .gitlab-ci/ml-variations/.triton.yml
- .gitlab-ci/ml-variations/.onnx-runtime.yml

variables:
IMAGE_TYPE: ml
Expand Down
3 changes: 2 additions & 1 deletion .gitlab-ci/os/.ubuntu20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ variables:
UBUNTU_VERSION: "20.04"
_TF_VERSION: 2.12.0
_TORCH_VERSION: 2.1.0
_TRITON_VERSION: 2.52.0
_TRITON_VERSION: 2.52.0
_ONNX_RUNTIME_VERSION: 1.13.1
3 changes: 2 additions & 1 deletion .gitlab-ci/os/.ubuntu22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ variables:
UBUNTU_VERSION: "22.04"
_TF_VERSION: 2.18.0
_TORCH_VERSION: 2.5.0
_TRITON_VERSION: 2.52.0
_TRITON_VERSION: 2.52.0
_ONNX_RUNTIME_VERSION: 1.20.1
1 change: 1 addition & 0 deletions .gitlab-ci/os/.ubuntu24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ variables:
_TF_VERSION: 2.18.0
_TORCH_VERSION: 2.5.0
_TRITON_VERSION: 2.52.0
_ONNX_RUNTIME_VERSION: 1.20.1
DISABLE_CUDA_ARM64: "true"
DISABLE_TENSORRT_ARM64: "true"
DISABLE_TORCH_ARM64: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ variables:
_TF_VERSION: 2.18.0
_TORCH_VERSION: 2.5.0
_TRITON_VERSION: 2.52.0
_ONNX_RUNTIME_VERSION: 1.20.1

DISABLE_PLAIN: "true"
DISABLE_TRITON: "true"
Expand Down
2 changes: 2 additions & 0 deletions .version_information.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ TENSORRT_VERSION=$(dpkg -l 2> /dev/null | grep -E "libnvinfer[0-9]" | awk '{ pri
PYTHON_VERSION=$(python --version | awk '{print $2}')
TF_PIP_VERSION=$(python -c "exec(\"try:\n import os; os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'; import tensorflow as tf; print(tf.__version__);\n\rexcept ImportError:\n pass\")")
PT_PIP_VERSION=$(python -c "exec(\"try:\n import torch; print(torch.__version__);\n\rexcept ImportError:\n pass\")")
ONNX_RUNTIME_VERSION=$(python -c "exec(\"try:\n import onnxruntime; print(onnxruntime.__version__);\n\rexcept ImportError:\n pass\")")

CMAKE_VERSION=$(cmake --version | grep version | awk '{print $3}')
if [[ $(command -v nvidia-smi) ]]; then
Expand Down Expand Up @@ -48,6 +49,7 @@ printf "║ %12s | %-61s ║\n" "Ubuntu" "$VERSION"
[[ -n "$TRITON_VERSION" ]] && printf "║ %12s | %-61s ║\n" "Triton Client" "$TRITON_VERSION"
[[ -n "$TF_PIP_VERSION" ]] && printf "║ %12s | %-61s ║\n" "TensorFlow" "$TF_PIP_VERSION"
[[ -n "$PT_PIP_VERSION" ]] && printf "║ %12s | %-61s ║\n" "PyTorch" "$PT_PIP_VERSION"
[[ -n "$ONNX_RUNTIME_VERSION" ]] && printf "║ %12s | %-61s ║\n" "ONNX RT" "$ONNX_RUNTIME_VERSION"
[[ -n "$NUM_GPUS" ]] && printf "║ %12s | %-61s ║\n" "GPUs" "$NUM_GPUS"
if [[ -n "$GPU_INFOS" ]]; then
IFS=$'\n'
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# --build-arg ROS_BUILD_FROM_SRC=$ROS_BUILD_FROM_SRC \
# --build-arg TORCH_VERSION=$TORCH_VERSION \
# --build-arg TF_VERSION=$TF_VERSION \
# --build-arg ONNX_RUNTIME_VERSION=$ONNX_RUNTIME_VERSION \
# --build-arg TRITON_VERSION=$TRITON_VERSION \
# --tag $IMAGE \
# .
Expand Down Expand Up @@ -262,6 +263,14 @@ RUN if [[ -n $TF_VERSION ]]; then \
fi; \
fi

# install ONNX Runtime
ARG ONNX_RUNTIME_VERSION
RUN if [[ -n $ONNX_RUNTIME_VERSION ]]; then \
if [[ "$TARGETARCH" == "amd64" ]]; then \
pip3 install onnxruntime-gpu==${ONNX_RUNTIME_VERSION}; \
fi; \
fi

# --- finalization -------------------------------------------------------------------------------

# user setup
Expand Down
251 changes: 127 additions & 124 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions utils/export_image_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"Triton": "echo \\$TRITON_VERSION",
"PyTorch": "python -c 'exec(\\\"try:\\n import torch; print(torch.__version__);\\n\\rexcept ImportError:\\n pass\\\")' | cut -d+ -f1 | cut -d- -f1 | sed 's/a0//g'",
"TensorFlow": "export TF_CPP_MIN_LOG_LEVEL='1' && python -c 'exec(\\\"try:\\n import os; import tensorflow as tf; print(tf.__version__);\\n\\rexcept ImportError:\\n pass\\\")' | cut -d+ -f1 | cut -d- -f1",
"ONNX RT": "python -c 'exec(\\\"try:\\n import onnxruntime; print(onnxruntime.__version__);\\n\\rexcept ImportError:\\n pass\\\")'",
}

SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
Expand Down