DerryHub / BEVFormer_tensorrt

BEVFormer inference on TensorRT, including INT8 Quantization and Custom TensorRT Plugins (float/half/half2/int8).
Apache License 2.0
433 stars 71 forks source link

A runtimeerror was encountered while converting the model to onnx #3

Closed weiyu-Liu closed 1 year ago

weiyu-Liu commented 1 year ago

Hello, When I use sh samples/bevformer/base/pth2onnx.sh -d 0, I got a runtime error:

RuntimeError: CUDA out of memory. Tried to allocate 236.00 MiB (GPU 0; 9.78 GiB total capacity; 8.04 GiB already allocated; 82.31 MiB free; 8.44 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Looks like enough memory, and I use RTX 3080. Do I need to switch to a graphics card with more memory? Thx.

DerryHub commented 1 year ago

You can modify the pth2onnx.sh file and remove --cuda. It will run on CPU instead of GPU. By the way, I recommend you to convert with custom plugins to save much memory.

yhwang-hub commented 1 year ago

how do i use custom plugins to convert?

DerryHub commented 1 year ago

how do i use custom plugins to convert?

Run the scripts in samples/bevformer/plugin. See README.md.