Downloads · 30 days
4
9% of all-time downloads
Magneto76/lora_blip2
lora_blip2 is a machine learning model from Magneto76. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Custom BLIP-2 model fine-tuned for visual question answering with LoRA adapters
Downloads · 30 days
4
9% of all-time downloads
All-time downloads
43
Public
Parameters
3.9B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.1 GB · 100%
How the weights are stored.
F163.8B · 97%
From the Hugging Face model README
Custom BLIP-2 model fine-tuned for visual question answering with LoRA adapters
from transformers import Blip2ForConditionalGeneration, Blip2Processor
import torch
model = Blip2ForConditionalGeneration.from_pretrained(
"Magneto76/lora_blip2",
torch_dtype=torch.float16,
device_map="auto"
)
processor = Blip2Processor.from_pretrained("Magneto76/lora_blip2")
def infer(image, question):
inputs = processor(image, question, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs)
return processor.decode(outputs[0], skip_special_tokens=True)