Downloads · 30 days
5
0% of all-time downloads
evlinzxxx/my_model_ViTB-16
my_model_ViTB-16 is a image-to-text model from evlinzxxx. Use it when you need a caption or text from an image. It is set up for transformers.
Downloads · 30 days
5
0% of all-time downloads
All-time downloads
1K
Public
Parameters
239M
1.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors957 MB · 100%
From the Hugging Face model README
from transformers import VisionEncoderDecoderModel, ViTImageProcessor, GPT2Tokenizer
import torch
from PIL import Image
model = VisionEncoderDecoderModel.from_pretrained("evlinzxxx/my_model_ViTB-16")
feature_extractor = ViTImageProcessor.from_pretrained("evlinzxxx/my_model_ViTB-16")
tokenizer = GPT2Tokenizer.from_pretrained("evlinzxxx/my_model_ViTB-16")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
def show_image_and_captions(url):
# get the image and display it
display(load_image(url))
# get the captions on various models
our_caption = get_caption(model, image_processor, tokenizer, url)
# print the captions
print(f"Our caption: {our_caption}")
show_image_and_captions("/content/drive/MyDrive/try/test_400/gl_16.jpg") # ['navigate around the obstacle ahead adjusting your route to bypass the parked car.']