Zum Inhalt springen
ModelAufgelistetExtern
Herunterladen

Lapvqa Vqa

Part of the LAPVQA collection.

ArtOtherVersionClip vit l14 bestCBewertung

Modellquelle

Art
Other
Dateigröße
196–197 MB
Version
vClip vit l14 best
Aktualisiert
10. Okt. 2026
Quelle
Hugging Face

Quellenbeschreibung

LAPVQA — VQA (Frozen Off-the-shelf Encoders)

Part of the LAPVQA collection.

Description

Lightweight task heads for Visual Question Answering on MIMIC-Diff-VQA, trained on top of five frozen off-the-shelf vision encoders. Each .pt file contains only the task head weights; load the encoder separately.

Architecture — VQAHead

vis_proj   : Linear(vis_dim → 512)
tok_emb    : Embedding(50257, 512)   # GPT-2 vocab, weight-tied with lm_head
pos_emb    : Embedding(150, 512)
decoder    : 6 × TransformerDecoderLayer (pre-norm, cross-attn to visual tokens)
lm_head    : Linear(512 → 50257, bias=False)
FileEncodervis_dim
clip-vit-l14_best.ptCLIP ViT-L/141024
siglip_best.ptSigLIP ViT-SO400M-14-3841152
florence2_best.ptFlorence-21024
coca_best.ptCoCa768
owlv2_best.ptOWLv21024

Results (test set, overall)

EncoderBLEU-1BLEU-4ROUGE-LRadGraph-s
CLIP ViT-L/140.6020.2430.7250.222
SigLIP0.5860.2530.7170.214
Florence-20.5750.2070.7000.217
CoCa0.5320.1730.6420.170

Loading

import torch
import tiktoken
from lapvqa.vqa.model import VQAHead

# checkpoint is a plain state dict
ckpt = torch.load("clip-vit-l14_best.pt", map_location="cpu")
head = VQAHead(vis_dim=1024)
head.load_state_dict(ckpt)
head.eval()

# vis_tokens: [B, N, vis_dim] — patch tokens from the frozen encoder
# prompt_ids: [B, Q]           — tokenised question (GPT-2 tokeniser)
enc = tiktoken.get_encoding("gpt2")
bos_id, eos_id = enc.eot_token, enc.eot_token

answers = head.generate(
    vis_tokens  = vis_tokens,
    prompt_ids  = prompt_ids,
    bos_id      = bos_id,
    eos_id      = eos_id,
    max_new_tokens = 64,
)
decoded = [enc.decode(ids) for ids in answers]

Quellen

1 Quelle
Hugging FacePrimärVersion fbbce5090e24f5d35c22fdccabbf4032731706f2
huggingface.co/dmusingu/lapvqa-vqa/tree/fbbce5090e24f5d35c22fdccabbf4032731706f2

Verifiziert 10. Okt.

Modellartefakte

5 Artefakte

clip-vit-l14_best.pt

pt · 197 MB · SHA-256 bdb36ecc0f9d…9eca · Hugging Face

Herunterladen

coca_best.pt

pt · 196 MB · SHA-256 2ebdbd2614b6…0732 · Hugging Face

Herunterladen

florence2_best.pt

pt · 197 MB · SHA-256 4523bcb65f91…dcb2 · Hugging Face

Herunterladen

owlv2_best.pt

pt · 197 MB · SHA-256 381b8c60db26…aa39 · Hugging Face

Herunterladen

siglip_best.pt

pt · 197 MB · SHA-256 bd486bc63a2c…5f79 · Hugging Face

Herunterladen

Quellenauszüge

2 Auszüge

--- tags: - chest-xray - radiology - visual-question-answering - mimic-cxr license: apache-2.0 --- # LAPVQA — VQA (Frozen Off-the-shelf Encoders) Part of the [LAPVQA collection](https://huggingface.co/collections/dmusingu/lapvqa). ## Description Lightweight task heads for **Visual Question Answering** on MIMIC-Diff-VQA, trained on top of five **frozen** off-the-shelf vision encoders. Each `.pt` file contains only the task head weights; load the encoder separately. ## Architecture — `VQAHead` ``` vis_proj : Linear(vis_dim → 512) tok_emb : Embedding(50257, 512) # GPT-2 vocab, weight-tied with lm_head pos_emb : Embedding(150, 512) decoder : 6 × TransformerDecoderLayer (pre-norm, cross-attn to visual tokens) lm_head : Linear(512 → 50257, bias=False) ``` | File | Encoder | vis_dim | |---|---|---| | `clip-vit-l14_best.pt` | CLIP ViT-L/14 | 1024 | | `siglip_best.pt` | SigLIP ViT-SO400M-14-384 | 1152 | | `florence2_best.pt` | Florence-2 | 1024 | | `coca_best.pt` | CoCa | 768 | | `owlv2_best.pt` | OWLv2 | 1024 | ## Results (test set, overall) | Encoder | BLEU-1 | BLEU-4 | ROUGE-L | RadGraph-s | |---|---|---|---|---| | CLIP ViT-L/14 | 0.602 | 0.243 | 0.725 | 0.222 | | SigLIP | 0.586 | 0.253 | 0.717 | 0.214 | | Florence-2 | 0.575 | 0.207 | 0.700 | 0.217 | | CoCa | 0.532 | 0.173 | 0.642 | 0.170 | ## Loading ```python import torch import tiktoken from lapvqa.vqa.model import VQAHead # checkpoint is a plain state dict ckpt = torch.load("clip-vit-l14_best.pt", map_location="cpu") head = VQAHead(vis_dim=1024) head.load_state_dict(ckpt) head.eval() # vis_tokens: [B, N, vis_dim] — patch tokens from the frozen encoder # prompt_ids: [B, Q] — tokenised question (GPT-2 tokeniser) enc = tiktoken.get_encoding("gpt2") bos_id, eos_id = enc.eot_token, enc.eot_token answers = head.generate( vis_tokens = vis_tokens, prompt_ids = prompt_ids, bos_id = bos_id, eos_id = eos_id, max_new_tokens = 64, ) decoded = [enc.decode(ids) for ids in answers] ```

Source context: 0 downloads · 0 likes · Pipeline visual-question-answering · Repo dmusingu/lapvqa-vqa