CLIP-FlanT5-XXL (VQAScore) — trust_remote_code HuggingFace format
Unofficial transformers-format port of CLIP-FlanT5-XXL, the VQAScore judge from "Evaluating
Text-to-Visual Generation with Image-to-Text Generation" (Lin et al., 2024). It bundles a self-contained
modeling_clipflant5.py and an auto_map, so the model loads with
AutoModelForSeq2SeqLM.from_pretrained(..., trust_remote_code=True) under transformers 5.X (and 4.57) with
no llava / t2v_metrics dependency and no pinned old transformers.
Not an official release. Model, weights, and architecture (
CLIPT5ForConditionalGeneration) are by Zhiqiu Lin et al. — original weightszhiqiulin/clip-flant5-xxl(Apache-2.0), code https://github.com/linzhiqiu/CLIP-FlanT5 and https://github.com/linzhiqiu/t2v_metrics, paper arXiv:2404.01291. This repo re-packages that checkpoint fortrust_remote_codeloading and is used as the paper-strict VQAScore judge for the CVTG-2K benchmark (TextCrafter, arXiv:2503.23461).
What it is
A CLIP ViT-L/14-336 vision tower + a FlanT5-XXL encoder-decoder. Image patch features are projected and
spliced into the T5 encoder inputs at an <image> placeholder; the T5 decoder then scores an answer.
VQAScore = the probability the decoder assigns to "Yes" for the question
'Does this figure show "{caption}"? Please answer yes or no.' (exp(-CrossEntropy) under teacher forcing) —
a reference-free image↔text alignment score.
modeling_clipflant5.py consolidates the upstream clip_t5.py + vision tower + projector + preprocessing
(t5_tokenizer_image_token, expand2square) into one module using only public T5/CLIP transformers API.
transformers-5.X note.
generate()/prepare_inputs_for_generationare intentionally removed — they indexed the legacy tuple KV-cache (gone in 5.X), and VQAScore needs only the teacher-forcedforward()+ logits. Use this model for scoring, not free-form generation.
Usage (scoring)
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("bigshanedogg/clip-flant5-xxl", trust_remote_code=True).eval()
tokenizer = AutoTokenizer.from_pretrained("bigshanedogg/clip-flant5-xxl")
# Preprocess the image with model.vision_tower.image_processor, wrap the question with
# `format_question(...)` (t5_chat), tokenize with `t5_tokenizer_image_token`, then run a teacher-forced
# forward with labels="Yes" and read exp(-CrossEntropy) — see modeling_clipflant5.py's docstring.
Licensing
- CLIP-FlanT5 model / weights / code (Zhiqiu Lin et al.): Apache-2.0 — https://github.com/linzhiqiu/CLIP-FlanT5
- FlanT5-XXL base (Google): Apache-2.0. OpenAI CLIP ViT-L/14-336 vision tower: MIT.
- This port (
modeling_clipflant5.py, packaging): Apache-2.0 — seeLICENSE; attribution inNOTICE.