下载代码
里面包含依赖
git clone https://github.com/OpenVINO-dev-contest/Qwen2.openvino.git
python环境配置
创建虚拟环境
conda create -name qwen2openvino python==3.10
conda activate qwen2openvino
安装依赖
pip install wheel setuptools
pip install -r requirements.txt
配置镜像服务器来加快下载速度
export HF_ENDPOINT=https://hf-mirror.com
下载模型
huggingface-cli download --resume-download --local-dir-use-symlinks False Qwen/Qwen1.5-0.5B-Chat --local-dir ./Qwen1.5-0.5B-Chat
转换模型
python convert.py --model_id ./Qwen1.5-0.5B-Chat --precision int4 --output ./Qwen1.5-0.5B-Chat-ov
在chat.py的前面加上,防止出现waring
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
【问题解决】module ‘triton.compiler‘ has no attribute ‘OutOfResources‘
[已解決] huggingface/tokenizers: The current process just got forked. after parallelism has already been used. Disabling parallelism to avoid deadlocks
运行chat.py
python chat.py --model_path ./Qwen1.5-0.5B-Chat-ov --max_sequence_length 4096 --device GPU
参考文章
(Qwen)通义千问大模型安装部署教程2024最新