多模态大模型微调Qwen-VL微调及日志

%pip install modelscope -U
%pip install transformers accelerate tiktoken -U
%pip install einops transformers_stream_generator -U
%pip install pillow -U
%pip install torchvision
%pip install matplotlib -U

from modelscope import (
snapshot_download, AutoModelForCausalLM, AutoTokenizer, GenerationConfig
)

import torch
torch.manual_seed(1234)

model_dir = ‘C:/zhaohuan/WorkSpace/Qwen-VL-Chat-Int4’
revision = ‘v1.1.0’

请注意:分词器默认行为已更改为默认关闭特殊token攻击防护。

tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(model_dir, device_map=“auto”, trust_remote_code=True, fp16=True)

你可能感兴趣的:(人工智能-大模型应用,python,人工智能,深度学习)