AterMors/wikiart_recaption
Viewer • Updated • 81.4k • 1.15k • 9
How to use AterMors/Swin2-GTP2_art-caption with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "image-to-text" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("image-to-text", model="AterMors/Swin2-GTP2_art-caption") # Load model directly
from transformers import AutoTokenizer, AutoModelForImageTextToText
tokenizer = AutoTokenizer.from_pretrained("AterMors/Swin2-GTP2_art-caption")
model = AutoModelForImageTextToText.from_pretrained("AterMors/Swin2-GTP2_art-caption")Image Captioning Model created with VisionEncoderDecoderModel architecture using "microsoft/swinv2-base-patch4-window12to16-192to256-22kto1k-ft" as image_encoder and "openai/gpt2" as text_decoder. It has been trained on a variant of the WikiArt dataset that can be found at "AterMors/wikiart_recaption".