Skip to content

Instantly share code, notes, and snippets.

@NateMeyer
Created March 3, 2024 19:35
Show Gist options
  • Save NateMeyer/a689b4462e57b3de0ebcc40e6538fc03 to your computer and use it in GitHub Desktop.
Save NateMeyer/a689b4462e57b3de0ebcc40e6538fc03 to your computer and use it in GitHub Desktop.
Frigate v0.13 TensorRT Maxwell-GPU Workaround

Using NVidia Maxwell GPUs w/ Frigate v0.13

There was a problem discovered wit hthe library shipped with v0.13 of Frigate that didn't include the correct instructions for Maxwell GPUs with CUDA Compute-level 5.0. This document describes how to rebuild this library and map it into Frigate v0.13.

Rebuild libyolo_layer.so

The library needs to be rebuilt with the correct compute-level instructions.

#!/bin/bash
set -euxo pipefail

apt-get update
apt-get install -y git build-essential cuda-nvcc-* cuda-nvtx-* libnvinfer-dev libnvinfer-plugin-dev libnvparsers-dev libnvonnxparsers-dev 

# Clone tensorrt_demos repo
git clone --depth 1 https://github.com/NateMeyer/tensorrt_demos.git -b conditional_download

# Build libyolo
if [ ! -e /usr/local/cuda ]; then
    ln -s /usr/local/cuda-* /usr/local/cuda
fi
cd ./tensorrt_demos/plugins && make all -j$(nproc) computes="${COMPUTE_LEVEL:-}"
cp libyolo_layer.so /out/libyolo_layer.so

Save the above script as libyolo.sh. Mark the script as executable and run the following docker command to rebuild libyolo_layer.so.

chmod a+x libyolo.sh
docker run --gpus=all --rm -it -v `pwd`:/out -e COMPUTE_LEVEL="50" -w /work nvcr.io/nvidia/tensorrt:23.03-py3 /out/libyolo.sh

Include the updated library in Docker Compose

Add the following volumes to your existing Docker Compose yml file to mount libyolo_layer.so over the one provided in the Docker image

services:
  frigate:
    volumes:
      - ./libyolo_layer.so:/usr/local/lib/libyolo_layer.so:ro
      - ./libyolo_layer.so:/usr/local/src/tensorrt_demos/plugins/libyolo_layer.so:ro
@alexonpeace
Copy link

alexonpeace commented Apr 15, 2024

how do I run this on UNRAID

Edit:
I followed this till "Include the updated library in Docker Compose" those I just added both as path in docker template
and I think it's working now :)
will update if it doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment