运行yolov5训练数据集,报错:RuntimeError: CUDA error: out of memory CUDA kernel errors might be asynchronously

运行yolov5报错:
RuntimeError: CUDA error: out of memory
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.
在这里插入图片描述

解决办法:减少batch_size,batch_size默认是16,然后我运行就显示这个错误,我查看网上的资料很多,对于我来说,我将batch_size改成4就可以成功运行了。
其他的解决办法:
能用就行——玄学问题:Compile with TORCH_USE_CUDA_DSA to enable device-side assertions

问题解决 |关于CUDA的代码错误总结以及解决方法

你可能感兴趣的:(目标检测yolov5,YOLO)