前言
想玩一下 LLM
直接来试试吧
SecGPT
1
| https://github.com/Clouditera/secgpt
|
前期准备
拉取源码
1
| git clone https://github.com/Clouditera/secgpt.git
|
安装依赖
官方依赖包
1
| python -m pip install -r requirements.txt
|
sentencepiece
1
| python -m pip install sentencepiece
|
1
| python -m pip install transformers_stream_generator
|
下载及运行 LLM 模型
1 2
| cd .\webdemo\ python webdemo.py --base_model w8ay/secgpt
|
运行成功效果
存在问题
设置服务器端口
启动端口报错
1 2
| - demo.queue().launch(server_name="0.0.0.0", share=share_gradio) + demo.queue().launch(server_name="0.0.0.0", share=share_gradio, server_port=7890)
|
CUDA 无法调用
python 环境无法调用
1 2
| import torch print(torch.cuda.is_available())
|
torch 没有调用 CUDA
- 显示
x.x.x+cpu 证明这是 CPU 版本 torch
1 2
| import torch print(torch.__version__)
|
更换 torch 版本
- 卸载
torch_CPU 组件
1
| python -m pip uninstall torch torchvision torchaudio
|
- 获取
torch 组件下载链接
1
| https://pytorch.org/get-started/locally/
|
- 安装
torch_CUDA 组件
1
| python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
检查 torch CUDA 版本
1 2 3 4 5 6 7 8 9 10
| import torch from torch.backends import cudnn
print(torch.__version__) print(torch.cuda.device_count()) print(torch.cuda.is_available()) print(torch.backends.cudnn.is_available()) print(torch.cuda_version) print(torch.backends.cudnn.version())
|
参考 & 引用
https://blog.csdn.net/Jay_Alon/article/details/128941761