环境ROG魔霸3060显卡
内存16G
CUDA版本11.6
步骤1:创建python隔离环境
conda create -n chat python=3.10
步骤2:进入虚拟环境
conda activate chat
步骤3:
conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.6 -c pytorch -c nvidia
步骤4:下载框架
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
步骤6:修改框架
requirements.txt #torch==2.1.2 因为这个是cpu版本不需要
步骤7:下载模型
git clone https://www.modelscope.cn/AI-ModelScope/bge-large-zh-v1.5.git
git clone https://www.modelscope.cn/ZhipuAI/ChatGLM-6B-Int4.git
步骤8:安装依赖
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -r requirements_api.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -r requirements_webui.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
额外加一个pip install cpm_kernels
步骤9:运行
python copy_config_example.py
步骤10:打开config文件夹修改model_config.py
EMBEDDING_DEVICE = "cuda"
LLM_DEVICE = "cuda"
LLM_MODELS = ["chatglm3-6b"]
"bge-large-zh-v1.5": "E:\\bge-large-zh-v1.5",
"chatglm3-6b": "E:\\chatglm2-6b-int4",
步骤11:初始化向量库
python init_database.py --recreate-vs
运行前再次检查
python -c "import torch; print(torch.cuda.is_available())" # 查看GPU是否可用
python -c "import torch; print(torch.cuda.device_count())" # 查看GPU数量
python -c "import torch; print(torch.cuda.get_device_name(0))" # 根据索引号得到GPU名称
如果还是匹配考虑离线安装
pip install torch-1.13.0+cu116-cp310-cp310-win_amd64.whl
下载地址:
步骤11:启动
python startup.py -a