最近接触chatglm3对话预训练模型,从git上下载,装包装半天,最后终于跑起来了,但是一对他进行对话,后台就开始报错了
File "E:\Python311\Lib\site-packages\torch\nn\modules\linear.py", line 114, in forward return F.linear(input, self.weight, self.bias)
反正大概是torch这个包有问题,于是就单独写个torch的代码执行一下,代码如下:
import torch
print("是否可用:", torch.cuda.is_available()) # 查看GPU是否可用
print("GPU数量:", torch.cuda.device_count()) # 查看GPU数量
print("torch方法查看CUDA版本:", torch.version.cuda) # torch方法查看CUDA版本
print("GPU名称:", torch.cuda.get_device_name()) # 根据索引号得到GPU名称
print("GPU索引号:", torch.cuda.current_device()) # 查看GPU索引号
然后就报错:说我的GPU显卡不可用