服务器上跑程序,出现这种错误,大概是因为程序太大内存不够,有以下两种解决方式:
1、batch_size设置太大,改小一点
2、cuda节点被占用,可以指定其他节点,一种方式:程序里面写device = torch.device(‘cuda:0’ if torch.cuda.is_available() else ‘cpu’),服务器里面写CUDA_VISIBLE_DEVICES=X;另一种方式:程序里面直接写os.environ[“CUDA_VISIBLE_DEVICES”] = “2,3”
RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 11.17 GiB total capacity; 1.10
最新推荐文章于 2024-05-24 11:01:27 发布