Downloads · 30 days
9
19% of all-time downloads
efeozdilek/blip2-flan-lora-finetuned-six-epoch
blip2-flan-lora-finetuned-six-epoch is a visual question answering model from efeozdilek. Use it for the visual question answering task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads · 30 days
9
19% of all-time downloads
All-time downloads
48
Public
Parameters
3.7B
15 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15 GB · 100%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
This code demonstrates how to use the fine-tuned BLIP-2 model with LoRA adapters to generate chest X-ray reports from medical images. It loads the base BLIP-2 model, applies the LoRA weights from this repository, and performs inference on an uploaded image in a Colab environment.
from PIL import Image
from IPython.display import display
import torch
from transformers import Blip2Processor, Blip2ForConditionalGeneration
from google.colab import files
from peft import PeftModel
# Upload image
uploaded = files.upload()
image_path = list(uploaded.keys())[0]
# Display image
image = Image.open(image_path).convert("RGB")
display(image)
# Load processor and model
model_id = "efeozdilek/blip2-flan-lora-finetuned-six-epoch"
processor = Blip2Processor.from_pretrained(model_id)
# Load base BLIP-2 and apply LoRA weights
base_model = Blip2ForConditionalGeneration.from_pretrained(
"Salesforce/blip2-flan-t5-xl",
device_map="auto",
torch_dtype=torch.float16
)
model = PeftModel.from_pretrained(base_model, model_id)
# Preprocess input
inputs = processor(images=image, return_tensors="pt")
inputs = {k: v.to(model.device, dtype=torch.float32) for k, v in inputs.items()}
# Generate report
model.eval()
with torch.no_grad():
generated_ids = model.generate(**inputs, max_new_tokens=256)
report = processor.tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print("\n📋 Generated Report:\n", report)
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]