Downloads · 30 days
10
1% of all-time downloads
snzhang/FilmTitle-Beit-GPT2
FilmTitle-Beit-GPT2 is a image-to-text model from snzhang. 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.
The model is used to generate the Chinese title of a random movie post. It is based on the BEiT and GPT2.
Downloads · 30 days
10
1% of all-time downloads
All-time downloads
988
Public
Parameters
264M
1 GB on disk
Likes
2
Public
Click a slice to open those files.
.bin506 MB · 50%
How the weights are stored.
F16239M · 90%
From the Hugging Face model README
The model is used to generate the Chinese title of a random movie post. It is based on the BEiT and GPT2.
The training data contains 5043 movie posts and their corresponding Chinese title which are collected by Movie-Title-Post
from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTokenizer
from PIL import Image
pretrained = "snzhang/FilmTitle-Beit-GPT2"
model = VisionEncoderDecoderModel.from_pretrained(pretrained)
feature_extractor = ViTFeatureExtractor.from_pretrained(pretrained)
tokenizer = AutoTokenizer.from_pretrained(pretrained)
image_path = "your image path"
image = Image.open(image_path)
if image.mode != "RGB":
image = image.convert("RGB")
pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values
output_ids = model.generate(pixel_values, **gen_kwargs)
preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
preds = [pred.strip() for pred in preds]
print(preds)
You can get more training details in FilmTitle-Beit-GPT2