Downloads · 30 days
11
4% of all-time downloads
kr-manish/fine-tune-image-caption-pokemon
fine-tune-image-caption-pokemon is a image-text-to-text model from kr-manish. 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 mit.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
11
4% of all-time downloads
All-time downloads
288
Public
Parameters
177M
2.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors707 MB · 100%
From the Hugging Face model README
#dataset used: polinaeterna/pokemon-blip-captions
#code
from transformers import AutoProcessor, AutoModelForCausalLM
import torch
from PIL import Image
import requests
#Preprocess the dataset
#Since the dataset has two modalities (image and text), the pre-processing pipeline will preprocess images and the captions.
#To do so, load the processor class associated with the model you are about to fine-tune.
from transformers import AutoProcessor
checkpoint = "microsoft/git-base"
processor = AutoProcessor.from_pretrained(checkpoint)
device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "kr-manish/git-base-pokemon" # Replace with your actual username and model name
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
url = "https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/pokemon.png" # Replace with the URL of your image
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(images=image, return_tensors="pt").to(device)
generated_ids = model.generate(pixel_values=inputs.pixel_values, max_length=50)
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_caption)
#a pink and purple pokemon character with big eyes
This model is a fine-tuned version of microsoft/git-base on an unknown dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Wer Score |
|---|---|---|---|---|
| 8.155 | 4.17 | 50 | 6.4318 | 25.1325 |
| 5.3386 | 8.33 | 100 | 4.0782 | 18.6484 |
| 3.3109 | 12.5 | 150 | 2.4303 | 9.4306 |
| 2.0471 | 16.67 | 200 | 1.5797 | 8.9592 |