根据git 上的回复,应该是模型和variable 没有load 到gpu 上,下面可解决。
Most likely that the net is not on GPU, try adding the following, just after weight loading:
if torch.cuda.is_available():
net = net.cuda()
本文介绍了一种常见问题的解决方案:当模型未能正确加载到GPU时,可以通过检查并确保模型实例已放置于GPU上来解决。具体操作是在加载权重之后,立即调用 `.cuda()` 方法将模型移至GPU。
根据git 上的回复,应该是模型和variable 没有load 到gpu 上,下面可解决。
Most likely that the net is not on GPU, try adding the following, just after weight loading:
if torch.cuda.is_available():
net = net.cuda()您可能感兴趣的与本文相关的镜像
PyTorch 2.5
PyTorch 是一个开源的 Python 机器学习库,基于 Torch 库,底层由 C++ 实现,应用于人工智能领域,如计算机视觉和自然语言处理
795
1191
880

被折叠的 条评论
为什么被折叠?