import torchfrom transformers import AutoProcessor, AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained( "XiaofengAlg/MechVL-4B-SFT", dtype=torch.bfloat16, device_map="auto")processor = AutoProcessor.from_pretrained("XiaofengAlg/MechVL-4B-SFT") messages = [{"role": "user", "content": [ {"type": "image", "url": "path/to/drawing.png"}, {"type": "text", "text": "图纸中标注的零件总长度是多少?"},]}]inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt",).to(model.device)out = model.generate(**inputs, max_new_tokens=1024)print(processor.decode(out[0], skip_special_tokens=True))