mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
Don't support tensorrt detector for amd64 builds
This commit is contained in:
parent
9ffa7f140c
commit
9cccef6444
@ -6,24 +6,29 @@ ARG DEBIAN_FRONTEND=noninteractive
|
|||||||
# Globally set pip break-system-packages option to avoid having to specify it every time
|
# Globally set pip break-system-packages option to avoid having to specify it every time
|
||||||
ARG PIP_BREAK_SYSTEM_PACKAGES=1
|
ARG PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
FROM tensorrt-base AS frigate-tensorrt
|
FROM wheels AS trt-wheels
|
||||||
ARG PIP_BREAK_SYSTEM_PACKAGES
|
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||||
ENV TRT_VER=8.6.1
|
|
||||||
|
|
||||||
# Install TensorRT wheels
|
# Install TensorRT wheels
|
||||||
COPY docker/tensorrt/requirements-amd64.txt /requirements-tensorrt.txt
|
COPY docker/tensorrt/requirements-amd64.txt /requirements-tensorrt.txt
|
||||||
RUN pip3 install -U -r /requirements-tensorrt.txt && ldconfig
|
COPY docker/main/requirements-wheels.txt /requirements-wheels.txt
|
||||||
|
RUN pip3 wheel --wheel-dir=/trt-wheels -c /requirements-wheels.txt -r /requirements-tensorrt.txt
|
||||||
|
|
||||||
|
FROM deps AS frigate-tensorrt
|
||||||
|
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||||
|
|
||||||
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
|
pip3 uninstall -y onnxruntime-openvino tensorflow-cpu \
|
||||||
|
&& pip3 install -U /deps/trt-wheels/*.whl
|
||||||
|
|
||||||
|
COPY --from=rootfs / /
|
||||||
|
COPY docker/tensorrt/detector/rootfs/etc/ld.so.conf.d /etc/ld.so.conf.d
|
||||||
|
RUN ldconfig
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
COPY --from=rootfs / /
|
|
||||||
|
|
||||||
# Dev Container w/ TRT
|
# Dev Container w/ TRT
|
||||||
FROM devcontainer AS devcontainer-trt
|
FROM devcontainer AS devcontainer-trt
|
||||||
|
|
||||||
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
||||||
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
|
||||||
COPY --from=trt-deps /usr/local/cuda-12.1 /usr/local/cuda
|
|
||||||
COPY docker/tensorrt/detector/rootfs/ /
|
|
||||||
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
pip3 install -U /deps/trt-wheels/*.whl
|
pip3 install -U /deps/trt-wheels/*.whl
|
||||||
|
|||||||
@ -2,8 +2,60 @@
|
|||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
ARG BASE_IMAGE
|
ARG BASE_IMAGE
|
||||||
|
ARG TRT_BASE=nvcr.io/nvidia/tensorrt:23.12-py3
|
||||||
|
|
||||||
|
# Build TensorRT-specific library
|
||||||
|
FROM ${TRT_BASE} AS trt-deps
|
||||||
|
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG COMPUTE_LEVEL
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y git build-essential cuda-nvcc-* cuda-nvtx-* libnvinfer-dev libnvinfer-plugin-dev libnvparsers-dev libnvonnxparsers-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target=/tensorrt_libyolo.sh \
|
||||||
|
/tensorrt_libyolo.sh
|
||||||
|
|
||||||
|
# COPY required individual CUDA deps
|
||||||
|
RUN mkdir -p /usr/local/cuda-deps
|
||||||
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||||
|
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libcurand.so.* /usr/local/cuda-deps/ && \
|
||||||
|
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libnvrtc.so.* /usr/local/cuda-deps/ && \
|
||||||
|
cd /usr/local/cuda-deps/ && \
|
||||||
|
for lib in libnvrtc.so.*; do \
|
||||||
|
if [[ "$lib" =~ libnvrtc.so\.([0-9]+\.[0-9]+\.[0-9]+) ]]; then \
|
||||||
|
version="${BASH_REMATCH[1]}"; \
|
||||||
|
ln -sf "libnvrtc.so.$version" libnvrtc.so; \
|
||||||
|
fi; \
|
||||||
|
done && \
|
||||||
|
for lib in libcurand.so.*; do \
|
||||||
|
if [[ "$lib" =~ libcurand.so\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) ]]; then \
|
||||||
|
version="${BASH_REMATCH[1]}"; \
|
||||||
|
ln -sf "libcurand.so.$version" libcurand.so; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Frigate w/ TensorRT Support as separate image
|
||||||
|
FROM deps AS tensorrt-base
|
||||||
|
|
||||||
|
#Disable S6 Global timeout
|
||||||
|
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
||||||
|
|
||||||
|
# COPY TensorRT Model Generation Deps
|
||||||
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
|
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
||||||
|
|
||||||
|
# COPY Individual CUDA deps folder
|
||||||
|
COPY --from=trt-deps /usr/local/cuda-deps /usr/local/cuda
|
||||||
|
|
||||||
|
COPY docker/tensorrt/detector/rootfs/ /
|
||||||
|
ENV YOLO_MODELS=""
|
||||||
|
|
||||||
|
HEALTHCHECK --start-period=600s --start-interval=5s --interval=15s --timeout=5s --retries=3 \
|
||||||
|
CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1
|
||||||
|
|
||||||
FROM ${BASE_IMAGE} AS build-wheels
|
FROM ${BASE_IMAGE} AS build-wheels
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
@ -47,11 +99,12 @@ RUN --mount=type=bind,source=docker/tensorrt/detector/build_python_tensorrt.sh,t
|
|||||||
&& TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh
|
&& TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh
|
||||||
|
|
||||||
COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt
|
COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt
|
||||||
|
|
||||||
RUN pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt
|
|
||||||
|
|
||||||
# See https://elinux.org/Jetson_Zoo#ONNX_Runtime
|
# See https://elinux.org/Jetson_Zoo#ONNX_Runtime
|
||||||
ADD https://nvidia.box.com/shared/static/9yvw05k6u343qfnkhdv2x6xhygze0aq1.whl /trt-wheels/onnxruntime_gpu-1.19.0-cp311-cp311-linux_aarch64.whl
|
ADD https://nvidia.box.com/shared/static/9yvw05k6u343qfnkhdv2x6xhygze0aq1.whl /tmp/onnxruntime_gpu-1.19.0-cp311-cp311-linux_aarch64.whl
|
||||||
|
|
||||||
|
RUN pip3 uninstall -y onnxruntime-openvino \
|
||||||
|
&& pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt \
|
||||||
|
&& pip3 install --no-deps /tmp/onnxruntime_gpu-1.19.0-cp311-cp311-linux_aarch64.whl
|
||||||
|
|
||||||
FROM build-wheels AS trt-model-wheels
|
FROM build-wheels AS trt-model-wheels
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
@ -92,8 +145,7 @@ RUN mkdir -p /etc/ld.so.conf.d && echo /usr/lib/ffmpeg/jetson/lib/ > /etc/ld.so.
|
|||||||
COPY --from=trt-wheels /etc/TENSORRT_VER /etc/TENSORRT_VER
|
COPY --from=trt-wheels /etc/TENSORRT_VER /etc/TENSORRT_VER
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
--mount=type=bind,from=trt-model-wheels,source=/trt-model-wheels,target=/deps/trt-model-wheels \
|
--mount=type=bind,from=trt-model-wheels,source=/trt-model-wheels,target=/deps/trt-model-wheels \
|
||||||
pip3 uninstall -y onnxruntime \
|
pip3 install -U /deps/trt-wheels/*.whl /deps/trt-model-wheels/*.whl \
|
||||||
&& pip3 install -U /deps/trt-wheels/*.whl /deps/trt-model-wheels/*.whl \
|
|
||||||
&& ldconfig
|
&& ldconfig
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
|
|||||||
@ -1,57 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.6
|
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
ARG TRT_BASE=nvcr.io/nvidia/tensorrt:23.12-py3
|
|
||||||
|
|
||||||
# Build TensorRT-specific library
|
|
||||||
FROM ${TRT_BASE} AS trt-deps
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
ARG COMPUTE_LEVEL
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y git build-essential cuda-nvcc-* cuda-nvtx-* libnvinfer-dev libnvinfer-plugin-dev libnvparsers-dev libnvonnxparsers-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target=/tensorrt_libyolo.sh \
|
|
||||||
/tensorrt_libyolo.sh
|
|
||||||
|
|
||||||
# COPY required individual CUDA deps
|
|
||||||
RUN mkdir -p /usr/local/cuda-deps
|
|
||||||
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
|
||||||
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libcurand.so.* /usr/local/cuda-deps/ && \
|
|
||||||
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libnvrtc.so.* /usr/local/cuda-deps/ && \
|
|
||||||
cd /usr/local/cuda-deps/ && \
|
|
||||||
for lib in libnvrtc.so.*; do \
|
|
||||||
if [[ "$lib" =~ libnvrtc.so\.([0-9]+\.[0-9]+\.[0-9]+) ]]; then \
|
|
||||||
version="${BASH_REMATCH[1]}"; \
|
|
||||||
ln -sf "libnvrtc.so.$version" libnvrtc.so; \
|
|
||||||
fi; \
|
|
||||||
done && \
|
|
||||||
for lib in libcurand.so.*; do \
|
|
||||||
if [[ "$lib" =~ libcurand.so\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) ]]; then \
|
|
||||||
version="${BASH_REMATCH[1]}"; \
|
|
||||||
ln -sf "libcurand.so.$version" libcurand.so; \
|
|
||||||
fi; \
|
|
||||||
done; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Frigate w/ TensorRT Support as separate image
|
|
||||||
FROM deps AS tensorrt-base
|
|
||||||
|
|
||||||
#Disable S6 Global timeout
|
|
||||||
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
|
||||||
|
|
||||||
# COPY TensorRT Model Generation Deps
|
|
||||||
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
||||||
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
|
||||||
|
|
||||||
# COPY Individual CUDA deps folder
|
|
||||||
COPY --from=trt-deps /usr/local/cuda-deps /usr/local/cuda
|
|
||||||
|
|
||||||
COPY docker/tensorrt/detector/rootfs/ /
|
|
||||||
ENV YOLO_MODELS=""
|
|
||||||
|
|
||||||
HEALTHCHECK --start-period=600s --start-interval=5s --interval=15s --timeout=5s --retries=3 \
|
|
||||||
CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
/usr/local/lib
|
|
||||||
/usr/local/cuda
|
|
||||||
/usr/local/lib/python3.11/dist-packages/tensorrt
|
|
||||||
/usr/local/lib/python3.11/dist-packages/nvidia/cudnn/lib
|
/usr/local/lib/python3.11/dist-packages/nvidia/cudnn/lib
|
||||||
/usr/local/lib/python3.11/dist-packages/nvidia/cuda_runtime/lib
|
/usr/local/lib/python3.11/dist-packages/nvidia/cuda_runtime/lib
|
||||||
/usr/local/lib/python3.11/dist-packages/nvidia/cublas/lib
|
/usr/local/lib/python3.11/dist-packages/nvidia/cublas/lib
|
||||||
/usr/local/lib/python3.11/dist-packages/nvidia/cufft/lib
|
/usr/local/lib/python3.11/dist-packages/nvidia/cufft/lib
|
||||||
|
/usr/local/lib/python3.11/dist-packages/nvidia/curand/lib/
|
||||||
|
/usr/local/lib/python3.11/dist-packages/nvidia/cuda_nvrtc/lib/
|
||||||
@ -1,17 +1,19 @@
|
|||||||
# NVidia TensorRT Support (amd64 only)
|
# NVidia TensorRT Support (amd64 only)
|
||||||
--extra-index-url 'https://pypi.nvidia.com'
|
--extra-index-url 'https://pypi.nvidia.com'
|
||||||
numpy < 1.24; platform_machine == 'x86_64'
|
cython==3.0.*; platform_machine == 'x86_64'
|
||||||
tensorrt == 8.6.1; platform_machine == 'x86_64'
|
nvidia_cuda_cupti_cu12==12.5.82; platform_machine == 'x86_64'
|
||||||
tensorrt_bindings == 8.6.1; platform_machine == 'x86_64'
|
nvidia-cublas-cu12==12.5.3.*; platform_machine == 'x86_64'
|
||||||
cuda-python == 11.8.*; platform_machine == 'x86_64'
|
nvidia-cudnn-cu12==9.3.0.*; platform_machine == 'x86_64'
|
||||||
cython == 3.0.*; platform_machine == 'x86_64'
|
nvidia-cufft-cu12==11.2.3.*; platform_machine == 'x86_64'
|
||||||
nvidia-cuda-runtime-cu12 == 12.1.*; platform_machine == 'x86_64'
|
nvidia-curand-cu12==10.3.6.*; platform_machine == 'x86_64'
|
||||||
nvidia-cuda-runtime-cu11 == 11.8.*; platform_machine == 'x86_64'
|
nvidia_cuda_nvcc_cu12==12.5.82; platform_machine == 'x86_64'
|
||||||
nvidia-cublas-cu11 == 11.11.3.6; platform_machine == 'x86_64'
|
nvidia-cuda-nvrtc-cu12==12.5.82; platform_machine == 'x86_64'
|
||||||
nvidia-cudnn-cu11 == 8.6.0.*; platform_machine == 'x86_64'
|
nvidia_cuda_runtime_cu12==12.5.82; platform_machine == 'x86_64'
|
||||||
nvidia-cudnn-cu12 == 9.5.0.*; platform_machine == 'x86_64'
|
nvidia_cusolver_cu12==11.6.3.*; platform_machine == 'x86_64'
|
||||||
nvidia-cufft-cu11==10.*; platform_machine == 'x86_64'
|
nvidia_cusparse_cu12==12.5.1.*; platform_machine == 'x86_64'
|
||||||
nvidia-cufft-cu12==11.*; platform_machine == 'x86_64'
|
nvidia_nccl_cu12==2.23.4; platform_machine == 'x86_64'
|
||||||
|
nvidia_nvjitlink_cu12==12.5.82; platform_machine == 'x86_64'
|
||||||
|
tensorflow==2.19.*; platform_machine == 'x86_64'
|
||||||
onnx==1.16.*; platform_machine == 'x86_64'
|
onnx==1.16.*; platform_machine == 'x86_64'
|
||||||
onnxruntime-gpu==1.20.*; platform_machine == 'x86_64'
|
onnxruntime-gpu==1.22.*; platform_machine == 'x86_64'
|
||||||
protobuf==3.20.3; platform_machine == 'x86_64'
|
protobuf==3.20.3; platform_machine == 'x86_64'
|
||||||
|
|||||||
@ -79,21 +79,13 @@ target "trt-deps" {
|
|||||||
inherits = ["_build_args"]
|
inherits = ["_build_args"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "tensorrt-base" {
|
|
||||||
dockerfile = "docker/tensorrt/Dockerfile.base"
|
|
||||||
context = "."
|
|
||||||
contexts = {
|
|
||||||
deps = "target:deps",
|
|
||||||
}
|
|
||||||
inherits = ["_build_args"]
|
|
||||||
}
|
|
||||||
|
|
||||||
target "tensorrt" {
|
target "tensorrt" {
|
||||||
dockerfile = "docker/tensorrt/Dockerfile.${ARCH}"
|
dockerfile = "docker/tensorrt/Dockerfile.${ARCH}"
|
||||||
context = "."
|
context = "."
|
||||||
contexts = {
|
contexts = {
|
||||||
wget = "target:wget",
|
wget = "target:wget",
|
||||||
tensorrt-base = "target:tensorrt-base",
|
wheels = "target:wheels",
|
||||||
|
deps = "target:deps",
|
||||||
rootfs = "target:rootfs"
|
rootfs = "target:rootfs"
|
||||||
}
|
}
|
||||||
target = "frigate-tensorrt"
|
target = "frigate-tensorrt"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user