Downloads · 30 days
5
1% of all-time downloads
michelecafagna26/blip-base-captioning-ft-hl-rationales
blip-base-captioning-ft-hl-rationales is a image-to-text model from michelecafagna26. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as apache-2.0.
BLIP base trained on the HL dataset for rationale generation of images
Downloads · 30 days
5
1% of all-time downloads
All-time downloads
613
Public
Parameters
247M
2 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin990 MB · 50%
How the weights are stored.
F32247M · 100%
From the Hugging Face model README
BLIP base trained on the HL dataset for rationale generation of images
| Cider | SacreBLEU | Rouge-L |
|--------|------------|---------|
| 46.11 | 6.21 | 19.74 |
import requests
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
processor = BlipProcessor.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-rationales")
model = BlipForConditionalGeneration.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-rationales").to("cuda")
img_url = 'https://datasets-server.huggingface.co/assets/michelecafagna26/hl/--/default/train/0/image/image.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
inputs = processor(raw_image, return_tensors="pt").to("cuda")
pixel_values = inputs.pixel_values
generated_ids = model.generate(pixel_values=pixel_values, max_length=50,
do_sample=True,
top_k=120,
top_p=0.9,
early_stopping=True,
num_return_sequences=1)
processor.batch_decode(generated_ids, skip_special_tokens=True)
>>> "she is on vacation."
@inproceedings{cafagna2023hl,
title={{HL} {D}ataset: {V}isually-grounded {D}escription of {S}cenes, {A}ctions and
{R}ationales},
author={Cafagna, Michele and van Deemter, Kees and Gatt, Albert},
booktitle={Proceedings of the 16th International Natural Language Generation Conference (INLG'23)},
address = {Prague, Czech Republic},
year={2023}
}