环境信息:
PyTorch 2.0.0
Python 3.8(ubuntu20.04)
Cuda 11.8
RTX 3090(24GB) * 1
模型
/home/zhangwei/llm
源码
/usr/local/project/conda/Qwen/Qwen
mkdir -p /usr/local/project/conda/Qwen #【用来存放Qwen2源码】
mkdir -p /home/zhangwei/llm #【用来存放Qwen2模型】cd /usr/local/project/conda/Qwen #【进入文件夹】
git clone https://github.com/QwenLM/Qwen.git #[下载Qwen源码】cd /usr/local/project/conda/Qwen/Qwenpip install -r requirements.txtpip install -r requirements_web_demo.txtcd /home/zhangwei/llm #【进入模型文件夹】#安装modelscope
pip install modelscope opencv-python#下载模型
modelscope download --model 'qwen/Qwen-7B-Chat-Int4' --cache_dir '/home/zhangwei/llm'
#下载模型
modelscope download --model 'qwen/Qwen2-72B-Instruct-GPTQ-Int4' --cache_dir '/home/zhangwei/llm'#如果提示缺AutoGPTQ就安装AutoGPTQ,cuda 11.7
#对于 CUDA 11.7:
pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu117/
#对于 CUDA 11.8:
pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
#对于 RoCm 5.4.2:
pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/rocm542/#运行时选择自己想要用的模型
#提示缺什么就用pip装什么,需要注意的是版本 cuda 、python 等版本的兼容问题
#web运行
#--server-port 指定运行端口
#--server-name 指定 IP
#-c 指定模型目录
python web_demo.py --server-port 6006 --server-name 0.0.0.0 -c /home/zhangwei/llm/qwen/Qwen-7B-Chat-Int4 #命令行运行
#-c 指定模型目录
python cli_demo.py -c /home/zhangwei/llm/qwen/Qwen-7B-Chat-Int4