swift
swift copied to clipboard
finetune 好的模型用不了
from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration import torch from PIL import Image import requests
from modelscope import snapshot_download from transformers import AutoModelForCausalLM, AutoTokenizer from peft import AutoPeftModelForCausalLM
device_count = torch.cuda.device_count() if device_count > 0: logger.debug("Select GPU device") device = torch.device("cuda") else: logger.debug("Select CPU device") device = torch.device("cpu")
processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
model = LlavaNextForConditionalGeneration.from_pretrained("finetune_output/checkpoint-478-merged", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map='auto')
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
../aten/src/ATen/native/cuda/Indexing.cu:1290: indexSelectLargeIndex: block: [162,0,0], thread: [32,0,0] Assertion srcIndex < srcSelectDimSize
failed.