Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) GPU • DeepStream Version 7.1 • JetPack Version (valid for Jetson only) • TensorRT Version 10.3.0
**• NVIDIA GPU Driver Version (valid for GPU only)**535.161.08 • Issue Type( questions, new requirements, bugs) • How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing) • Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
Hi,
I’m trying to create tensorRT engine files from yolo-8s-seg onnx file while changing the input size to 1920x1088, the same process works in deepstream 6.3, but fails with deepstream 7.1 (also fails in 7.0), the process goes like this:
first I’m using the utils/export_yoloV8_seg.py from the repository: GitHub - marcoslucianops/DeepStream-Yolo-Seg: NVIDIA DeepStream SDK 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 implementation for YOLO-Segmentation models
like this:
python utils/export_yoloV8_seg.py -w yolov8s-seg.pt -s 1088 1920
this succeed both in deepstream 6.3 and in 7.1 (I’m doing it in a docker based on: nvcr.io/nvidia/deepstream:6.3-gc-triton-devel in 6.3 and in docker based on: nvcr.io/nvidia/deepstream:7.1-triton-multiarch)
then using trtexec I’m trying to create the engine like this:
trtexec --onnx=yolov8s-seg_1088_1920.onnx --saveEngine=yolov8s-seg_1088_1920.onnx-fp32-1088_1920-batch-1.engine
this command succeeds in 6.3 but fails in 7.1 with this message:
[12/08/2024-17:34:07] [E] Error[1]: [defaultAllocator.cpp::allocate::31] Error Code 1: Cuda Runtime (out of memory)
[12/08/2024-17:34:07] [W] [TRT] Requested amount of GPU memory (805441351680 bytes) could not be allocated. There may not be enough free memory for allocation to succeed.
[12/08/2024-17:34:07] [E] Error[1]: IBuilder::buildSerializedNetwork: Error Code 1: Myelin ([tunable_graph.cpp:create:117] autotuning: User allocator error allocating 805441351680-byte buffer)
[12/08/2024-17:34:07] [E] Engine could not be created from network
[12/08/2024-17:34:07] [E] Building engine failed
[12/08/2024-17:34:07] [E] Failed to create engine from model or file.
[12/08/2024-17:34:07] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v100300] # trtexec --onnx=yolov8s-seg_1088_1920.onnx --saveEngine=yolov8s-seg_1088_1920.onnx-fp32-1088_1920-batch-1.engine
To address the out-of-memory error you’re encountering while creating a TensorRT engine from a YOLOv8 ONNX model in DeepStream 7.1, let’s go through various potential causes of this issue and suggest solutions:
Possible Causes of Out-of-Memory Error
Insufficient GPU Memory:
The requested memory for the YOLOv8 model exceeds the available GPU memory, leading to the out-of-memory error.
Model Complexity:
YOLOv8 may have a high model complexity that uses extensive memory during engine building and inference.
Memory Management Changes:
Differences in memory management between TensorRT versions, especially between DeepStream 6.3 and 7.1, can result in more stringent memory requirements.
Unused Resources:
Other applications or processes might be consuming GPU memory, leaving insufficient resources for your TensorRT engine build.
Suggested Solutions
Reduce Batch Size:
Lower the batch size when invoking trtexec. For example, instead of batch=1, try creating the engine with a smaller batch size or test with explicit batch size adjustments.
Before converting, optimize your ONNX model by minimizing or fusing layers where possible. You can use tools such as ONNX Graph Optimization Toolkit to help reduce the size/complexity.
Profile GPU Memory Usage:
Use tools like nvidia-smi to monitor GPU memory usage while running the TensorRT commands. This will help identify if other processes are consuming memory.
watch -n 1 nvidia-smi
Upgrade Drivers and TensorRT:
Ensure you’re on the latest NVIDIA driver and TensorRT version. Compatibility improvements and updated memory management features might resolve issues.
You may want to check if there are newer versions than 8.6.1 that could yield better results.
Clean Up GPU Resources:
Restart the system or the container to ensure all previous memory allocations are cleared if you’ve run multiple tests or failed builds.
Use Profiling Tools:
Use TensorRT profiling tools to gain insights into memory usage during engine building. Profiling may reveal unoptimized sections of your model or excessive memory requirements.
Consider Increasing GPU Memory:
If the hardware allows, running on a different GPU with more memory could also be a solution if you are constrained by memory limits.
By following these steps and suggestions, you should be able to mitigate the out-of-memory error and successfully create the TensorRT engine file from your YOLOv8 ONNX model while utilizing DeepStream 7.1.