Gpu 运行时错误:在系统上找不到NVIDIA驱动程序
我在使用torch加载模型时遇到了问题,torch是使用GPU训练的,我正在尝试使用CPU加载该模型。然而,我成功地加载了模型,但在预测结果时,我得到了错误。但是,如果我使用GPU机器,我可以预测输出,但不能在CPU上预测: 我的代码:Gpu 运行时错误:在系统上找不到NVIDIA驱动程序,gpu,cpu,torch,huggingface-transformers,seq2seq,Gpu,Cpu,Torch,Huggingface Transformers,Seq2seq,我在使用torch加载模型时遇到了问题,torch是使用GPU训练的,我正在尝试使用CPU加载该模型。然而,我成功地加载了模型,但在预测结果时,我得到了错误。但是,如果我使用GPU机器,我可以预测输出,但不能在CPU上预测: 我的代码: ****To save the model I am using :**** PATH = "model.pt" torch.save(model, PATH) **To Load the Model** import torch
****To save the model I am using :****
PATH = "model.pt"
torch.save(model, PATH)
**To Load the Model**
import torch
PATH = "model.pt"
device = torch.device('cpu')
loaded_model=torch.load(PATH, map_location=device)
我能够成功加载模型。但在预测时,我得到了运行时错误
**Predicting the loaded model using CPU**
predicted_title = loaded_model.predict([abstract])
运行时错误:在系统上找不到NVIDIA驱动程序。请检查您是否有NVIDIA GPU并安装了驱动程序
如果错误很简单,我很抱歉,但我无法更正此错误。您可以使用设备输出模型
print(loaded_model.device)
如果不是cpu,请执行以下操作:
model = model.to('cpu')
好吧,根据法律,这应该行得通。您能否验证摘要是否也在CPU设备上?