Kaggle 环境下 PaddlePaddle 报错:'ValueError: The device should not be <re.Match object; span=(0, 5), match='gpu:0'>, since PaddlePaddle is not compiled with CUDA' 的解决方法
根据错误提示,PaddlePaddle没有编译CUDA,因此不能使用GPU。需要将设备设置为CPU,即将以下代码:
paddle.set_device('gpu:0')
修改为:
paddle.set_device('cpu')
另外,还需要修改模型最后一层的输出大小,将原来的1000改为12,即:
model.fc = paddle.nn.Linear(in_features=2048, out_features=12)
原文地址: https://www.cveoy.top/t/topic/oHHN 著作权归作者所有。请勿转载和采集!