Contents

llama2模型 类chatGPT产品体验

简介

一个语言模型,类似chatGPT. 可以本地部署, 下面列下规格

  • 7b 需要6~8GB显存
  • 13b 需要13~16GB显存
  • 70b 需要48GB显存,可以2张4090

安装

申请和下载模型

点击 https://huggingface.co/meta-llama

选择模型 Llama2-chat,13B 下载

将会跳转到Facebook公司的申请界面,勾选协议,提交申请

平替方案

如果觉得麻烦

下载这个GGML模型 https://huggingface.co/TheBloke/Firefly-Llama2-13B-v1.2-GGML

firefly-llama2-13b-v1.2.ggmlv3.q6_K.bin

文件链接 https://huggingface.co/TheBloke/Firefly-Llama2-13B-v1.2-GGML/blob/main/firefly-llama2-13b-v1.2.ggmlv3.q6_K.bin

python虚拟环境

# 创建python虚拟环境
python -m venv ./venv
# 进行python虚拟环境
./venv/Script/activate

安装pytorch with cuda

# https://pytorch.org/get-started/locally/
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

安装ui

# 安装ui
git clone https://github.com/oobabooga/text-generation-webui.git
# 进入ui目录
cd text-generation-webui
# 安装ui依赖
pip install -r requirements.txt
# 修复bitsandbytes bug
pip uninstall bitsandbytes
pip install bitsandbytes-windows
# 启动UI
python server.py

使用

实操llama2 GGML 13B q6_K

将模型放入ui目录下的models文件夹,

重启服务python server.py

cli界面会有一个url

打开本地web,来到首页

操作页面

载入模型

点击Model选项卡,点击刷新模型图标按钮,下拉模型,选择load按钮,

点击save settings

选择聊天模型

点击session选项卡,选择mode:chat,然后apply and restart

开始聊天

在input框内部输入你的问题,点击generate 开始对话

总结

用英文交流回复还行,用中文就太慢了