qwen2.5vl 模型配置记录
【代码】qwen2.5vl 记录。
·
创建环境
- 使用python版本3.10 (可以自己选择)
conda create -n qwen2.5vl python=3.10 - 查看自己的cuda版本
nvcc -V # 我的版本是12.1 所以下面都是用cu121 - 下载对应版本的torch及其相关
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121 - 下载huggingface的transfomrer accelerate相关
pip install git+https://github.com/huggingface/transformers accelerate - 下载qwen vl utils
pip install qwen-vl-utils[decord]==0.0.8
下载qwen vl模型
- 安装
hfd.sh(HF-Mirror 官方推荐下载工具)wget https://hf-mirror.com/hfd/hfd.sh chmod +x hfd.sh export HF_ENDPOINT=https://hf-mirror.com - 安装依赖
aria2apt-get update && apt-get install -y aria2 git - 使用hfd下载
./hfd.sh Qwen/Qwen2.5-VL-3B-Instruct \ --local-dir /your/path/to/models--Qwen--Qwen2.5-VL-3B-Instruct
验证下载
from transformers import AutoModelForVision2Seq, AutoProcessor
model_path = "/path/to/your/models--Qwen--Qwen2.5-VL-3B-Instruct"
model = AutoModelForVision2Seq.from_pretrained(
model_path,
trust_remote_code=True, # Qwen 系列通常需要
device_map="auto"
)
processor = AutoProcessor.from_pretrained(
model_path,
trust_remote_code=True
)
更多推荐
所有评论(0)