Views
No views yet
| Cider | SacreBLEU | Rouge-L |
|--------|------------|---------|
| 46.11 | 6.21 | 19.74 |1import requests
2from PIL import Image
3from transformers import BlipProcessor, BlipForConditionalGeneration
4
5processor = BlipProcessor.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-rationales")
6model = BlipForConditionalGeneration.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-rationales").to("cuda")
7
8img_url = 'https://datasets-server.huggingface.co/assets/michelecafagna26/hl/--/default/train/0/image/image.jpg'
9raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
10
11
12inputs = processor(raw_image, return_tensors="pt").to("cuda")
13pixel_values = inputs.pixel_values
14
15generated_ids = model.generate(pixel_values=pixel_values, max_length=50,
16 do_sample=True,
17 top_k=120,
18 top_p=0.9,
19 early_stopping=True,
20 num_return_sequences=1)
21
22processor.batch_decode(generated_ids, skip_special_tokens=True)
23
24>>> "she is on vacation."1@inproceedings{cafagna2023hl,
2 title={{HL} {D}ataset: {V}isually-grounded {D}escription of {S}cenes, {A}ctions and
3{R}ationales},
4 author={Cafagna, Michele and van Deemter, Kees and Gatt, Albert},
5 booktitle={Proceedings of the 16th International Natural Language Generation Conference (INLG'23)},
6address = {Prague, Czech Republic},
7 year={2023}
8}