spacewalk01 / depth-anything-tensorrt

TensorRT implementation of Depth-Anything V1, V2
https://depth-anything.github.io/
MIT License
227 stars 28 forks source link

Uncaught exception detected: Unable to open library: nvinfer_plugin.dll #19

Closed Hperigo closed 3 months ago

Hperigo commented 3 months ago

Hello,

I'm trying to run the command to convert the .onxx model to the .engine extension but I'm running in this issue where the nvinfer_plugin.dll cannot be open.

I triple checked things and the DLL is in the correct PATH ( I tried both adding it to the PATH and also copying the files to the cuda bin and lib folder) but I always get the same error message.

Any guidance would be greatly appreciated.

I tried with both TensorRT-8.6.1.6.Windows10.x86_64.cuda-12.0 and TensorRT-8.6.0.12.Windows10.x86_64.cuda-12.0; as well as Cuda 12.0 and Cuda 12.4

a couple of extra questions:

  1. Would it be possible to provide the .engine model in the repo ?
  2. Do you think it's possible to use and load the onxx model directly?

thank you

spacewalk01 commented 3 months ago

Engine file should be created for your gpu. So if I put engine in repo, it wouldn't work for most people. It is recommend to build the engine for your gpu and cuda version. Yes it is possible to load onnx file and create an engine without using trtexec.exe. Early version of the code has this functionality but we removed it to simplify the code. You may check at early commits.

spacewalk01 commented 3 months ago

Add the TensorRT library files to your system PATH. To do so, copy the DLL files from tensorrt_install_path/lib to your CUDA installation directory, for example, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin, where vX.Y is your CUDA version. The CUDA installer should have already added the CUDA path to your system PATH.

spacewalk01 commented 3 months ago

Or you can add tensorrt dlls in lib dir to bin dir where trtexec locates.

spacewalk01 commented 3 months ago

Printing the error message here could help.

Hperigo commented 3 months ago

Hello, thank you for taking the time to answer.

I started following your suggestion of implementing the old code and doing the conversion from inside c++. When I got that compiled I got an error saying it was unable to load the dll from cudnn 8.8

I installed cudnn and the error got fixed. Probably nvinfer_plugin.dll was trying to load something from there and it was failing without giving any errors indicating that..

Note that I had to run export_to_onxx.py using python 3.10 ( It's just the other version I had installed, maybe 3.11 can work as well) but 3.12 failed to install the onnx package via pip

gonna close the issue :)

spacewalk01 commented 3 months ago

Hi, I added build engine functionality in recent version:

https://github.com/spacewalk01/depth-anything-tensorrt/blob/5728dec780d18587668739e9e0b1600d8e9e99c5/depth_anything.cpp#L45