When converting yolov7's export.py, the memory error is reported. If reserved memory is >> allocated memory try setting max_split_size_mb to a

报错内容:export failure: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 2.45 GiB already allocated; 0 bytes free; 2.54 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

Solution:
add

import os
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128"

If not, add this sentence to include-nms

default=['torchscript'],

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44021553/article/details/128223155