-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
TensorRT with GPU, Docker image size, and base image for building a docker image #11452
Comments
👋 Hello @hlmhlr, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit. Introducing YOLOv8 🚀We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀! Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects. Check out our YOLOv8 Docs for details and get started with: pip install ultralytics |
I got a same question as you on Centos just minutes ago. If you get a way to deal with it, please share the solution with me. Thanks so much! Looking forward to your reply. |
@hlmhlr hello, Thank you for reaching out. I would be glad to help you with your issue. Regarding your question about the Furthermore, in regards to your question about the I hope you find this helpful, and please let me know if you have any further questions or require additional assistance. Best, |
Hi, Many thanks @glenn-jocher for your prompt and generous response. I tried to use the compatibility matrix from here, and I found the combination: In my system, I had cuda11.4 and I installed 8.8.0 as shown below which I verified outside the docker container. I don't know that how to verify Cuda and Cudnn inside the docker container. Also does the yolov5 docker image already contain Cuda or it automatically initializes Cuda which is already installed on the system? Later, I installed After having these libraries, I ran the code again and it threw the error again as shown below: How do I make sure the correct packages or their right combination and their installation? Which packages do I have to install inside or outside the docker to make them run from the docker? Further, every time I have to re-install the Also, I found the cudnn8.2.4 with cuda11.4 as mentioned here. So, I installed this cudnn version which is installed correctly as shown below: Besides, I tried to use some earlier version of tensorrt (8.2.2.8) and this time I installed it outside the docker but inside the anaconda. Unfortunately, it also did not work. The same practice I did with one of the conda virtual environments but it also did not work. Like its completely messy. Any help would be really appreciated. |
@hlmhlr hello, Thank you for reaching out. It seems like you have encountered issues with the compatibility between CUDA, cuDNN and TensorRT inside and outside the Docker container. To verify the installed CUDA and cuDNN versions inside the Docker container, you can check via the terminal by running the following commands:
The first command displays the version of CUDA installed, while the second command displays the version information of the installed CUDA. The third command displays the installed cuDNN version. Regarding your question about TensorRT installation, it looks like you have installed TensorRT successfully inside the Docker container using To properly configure the compatibility between these components, I would recommend checking the version compatibility matrix for CUDA, cuDNN and TensorRT provided by NVIDIA, and then installing the compatible versions of each package based on your requirements. If you are running into issues after following the compatibility matrix, be sure to check your TensorFlow/PyTorch version compatibility to make sure that the installed software versions are compatible with each other. I hope this helps. Let me know if you have any additional questions or concerns. |
Hi, @glenn-jocher, Many thanks for your prompt and generous response. I shall get back soon after troubleshooting. |
Hi @hlmhlr, You're welcome! I'm glad that my response was helpful. Please take your time to troubleshoot the issue, and don't hesitate to reach out if you have any further questions or concerns. I'm always here to help. Best regards, |
Hi @glenn-jocher, I tried to figure out the cuda and cudnn inside the docker image but there were non as shown in this figure. For the sake of clarity, I removed the yolov5 docker image and re-pulled it from the docker hub, however, it was unsuccessful. Later, I tried to mount the cuda and cuddn installed on my system, while running the docker image by using the following command and this time it worked.
So, now the combination that worked is: For Execution of the sample program is:
Concerning the installation of
Everything is up now. @liquored, if you are still facing the issue, you can try this. @glenn-jocher, many thanks again and I would request you to please confirm the output of the sample program as mentioned above that everything working is fine as per your references. Also, you may please close this issue with your comments. |
Hi @hlmhlr, I'm glad to hear that you were able to resolve the issue by mounting the CUDA and cuDNN installation from your system inside the Docker container. It's also good to know that you found the compatible versions of CUDA, cuDNN, and TensorRT that work for you. Regarding the sample program output, it looks like everything is working fine based on your references. The program successfully exported the YOLOv5s model to ONNX format and then converted it to TensorRT to accelerate inference on an NVIDIA GPU. Thank you for your detailed explanation of the steps you took to resolve the issue and for sharing your Dockerfile. This will be helpful for others who may encounter the same issue in the future. Please don't hesitate to reach out if you have any further questions or concerns. I'll be happy to assist you. Best regards, |
Hi @glenn-jocher, Thanks for your feedback. Also many thanks once again for your prompt and informative responses. Kind regards, |
Hi @hlmhlr, You're welcome! I'm glad that my responses were helpful and informative. If you have any further questions or concerns, don't hesitate to reach out. I'm always here to help. Best, |
Search before asking
Question
Hi,
The question is related to running Yolov5 with TensorRT on Docker. I found a similar context here but the issue I am facing is different.
I pulled yolov5 latest docker image, and run the the command
python export.py --weights yolov5s.pt --include engine --imgsz 640 --device 0
to convert the weight file from .pt totensorrt
but it threw the error shown below:Later, I tried to solve the error using this issue which installed the
tensorrt
and its snapshot is shown below:
After that, I used the previous command again
python export.py --weights yolov5s.pt --include engine --imgsz 640 --device 0
and it threw the following error:tensorrt
to run. How do I make sure the installation oftensorrt
is compatible with Cuda so that GPU could be initialized? However, thenvidia-smi
works fine both inside and outside the docker.During debugging, I used the base image
nvcr.io/nvidia/pytorch:21.11-py3
as mentioned in this issue, and generated yolov5 image locally but it also did not help out.I used the following Dockerfile to generate the image
My quuestions are basic but i am a newbie to play with dockers so i would appreciate for a generous reposne.
Thanks,
Additional
I am using the machine and libraries with following specifications :
The specifications at docker side are:
The issue can be reproduced by following commands (given that docker container is already installed):
The text was updated successfully, but these errors were encountered: