昆山网站建设网站建设,网页设计与制作智慧树单元检测答案,全面的手机网站建设,网站怎样设计网址目录 报错查看已安装的torch的版本卸载安装GPU版本的torch查看cuda版本手工安装通过pip命令手工安装。 结果更新cuda到12.1大功告成 报错
经查阅#xff0c;这个问题是因为conda默认安装的是CPU版本的torch#xff0c;应该使用GPU版本的。
查看已安装的torch的版本
pip li… 目录 报错查看已安装的torch的版本卸载安装GPU版本的torch查看cuda版本手工安装通过pip命令手工安装。 结果更新cuda到12.1大功告成 报错
经查阅这个问题是因为conda默认安装的是CPU版本的torch应该使用GPU版本的。
查看已安装的torch的版本
pip list 这种不带后缀的就CPU版本的。
卸载
pip uninstall torch
安装GPU版本的torch
注意这个特别要注意版本兼容需要兼顾 1.cuda 12.0 2.python 3.11
查看cuda版本
命令nvidia-smi 我的是12.0算比较新的就不更新了。
手工安装
如果直接从资料库安装很慢建议下载后手工安装。 地址https://mirror.sjtu.edu.cn/pytorch-wheels/cu121/?mirror_intel_list 需要3个文件
通过pip命令手工安装。 pip install “d:\ai\torchaudio-2.1.0cu121-cp311-cp311-win_amd64.whl” 结果
之前的不报错了。 又报新的错误 File D:\ProgramData\anaconda3\envs\chatglm\Lib\site-packages\cpm_kernels\library\base.py, line 72, in wrapperraise RuntimeError(Library %s is not initialized % self.__name)
RuntimeError: Library cublasLt is not initialized更新cuda到12.1
NVIDIA Corporation\PhysX\Common下缺少cudart64_65.dll文件 想到cuda是12.0与torch要求的12.1还是有些许差异。更新到12.1. 文件出现了
大功告成
再次运行程序终于成功了
# This is a sample Python script.# Press ShiftF10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.from transformers import AutoTokenizer, AutoModeltokenizer AutoTokenizer.from_pretrained(D:\AI\chatglm3-6b, trust_remote_codeTrue)
model AutoModel.from_pretrained(D:\AI\chatglm3-6b, trust_remote_codeTrue).quantize(4).half().cuda()
model model.eval()
response, history model.chat(tokenizer, 你好, history[])
print(response)D:\ProgramData\anaconda3\envs\chatglm\python.exe C:\Users\frohman\PycharmProjects\pythonProject\main.py
Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Loading checkpoint shards: 100%|██████████| 7/7 [00:5000:00, 7.27s/it]
你好我是人工智能助手 ChatGLM3-6B很高兴见到你欢迎问我任何问题。Process finished with exit code 0