当前位置:   article > 正文

OutOfMemoryError: CUDA out of memory.Tried to allocate 128.00 MiB.......却未占用显存,个人方法简单实用_pytorch_cuda_alloc_conf=expandable_segments:true

pytorch_cuda_alloc_conf=expandable_segments:true

完整报错提示OutOfMemoryError: CUDA out of memory. Tried to allocate 128.00 MiB. GPU 0 has a total capacity of 6.00 GiB of which 0 bytes is free. Of the allocated memory 5.25 GiB is allocated by PyTorch, and 834.00 KiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

笔者的显存大小为6g,但没有占用gpu,猜测是显存过小导致的问题

笔者直接在命令行运行相关python文件,因此找到目标文件

在右下角添加quantize(4),就保证代码的正常运行

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/518135
推荐阅读
相关标签
  

闽ICP备14008679号