There is an issue with the call

#1
by DavidHouse2024 - opened

There is an issue with the code "model = AutoModelForSeq2SeqLM.from_pretrained("fatehmujtaba/blip-image-captioning-base-for-Chest-Xray")"
KeyError: 'blip'

This is how you inference the above model "fatehmujtaba/blip-image-captioning-base-for-Chest-Xray"

import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
from transformers import BlipForConditionalGeneration, AutoProcessor

model = BlipForConditionalGeneration.from_pretrained("fatehmujtaba/blip-image-captioning-base-for-Chest-Xray",token=token).to(device)
processor = AutoProcessor.from_pretrained("fatehmujtaba/blip-image-captioning-base-for-Chest-Xray",token=token)
inputs = processor(images=image, return_tensors="pt").to(device)
pixel_values = inputs.pixel_values

generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]

This comment has been hidden
fatehmujtaba changed discussion status to closed

Sign up or log in to comment