Downloads · 30 days
11
1% of all-time downloads
gokaygokay/paligemma-docci-transformers
paligemma-docci-transformers is a image-text-to-text model from gokaygokay. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Fine tuned version of PaliGemma model on google/docci dataset.
Downloads · 30 days
11
1% of all-time downloads
All-time downloads
996
Public
Parameters
2.9B
11.7 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors11.7 GB · 100%
From the Hugging Face model README
Fine tuned version of PaliGemma model on google/docci dataset.
pip install git+https://github.com/huggingface/transformers
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
from PIL import Image
import requests
import torch
model_id = "gokaygokay/paligemma-docci-transformers"
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
image = Image.open(requests.get(url, stream=True).raw)
model = PaliGemmaForConditionalGeneration.from_pretrained(model_id).eval()
processor = AutoProcessor.from_pretrained(model_id)
## prefix
prompt = "caption en"
model_inputs = processor(text=prompt, images=image, return_tensors="pt")
input_len = model_inputs["input_ids"].shape[-1]
with torch.inference_mode():
generation = model.generate(**model_inputs, max_new_tokens=256, do_sample=False)
generation = generation[0][input_len:]
decoded = processor.decode(generation, skip_special_tokens=True)
print(decoded)
<!-- gokaygokay-citation -->
This model release is maintained by Gökay Aydoğan. If you reference this repository in academic work, please cite it as follows and also cite the upstream models, datasets, or projects it builds upon.
@software{aydogan2024paligemma_docci_transformers,
author = {Aydoğan, Gökay},
title = {{paligemma-docci-transformers}},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/gokaygokay/paligemma-docci-transformers},
note = {Model repository; cite the base model and upstream datasets as required.}
}