Views
No views yet
{state_dict, vis_dim, d_model, num_layers, nhead, encoder, epoch, val_bleu4}.ReportGenerationHeadvis_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)
lm_head : Linear(512 → 50257, bias=False)| Encoder | BLEU-4 | ROUGE-L | RadGraph-s |
|---|---|---|---|
| SigLIP | 0.036 | 0.168 | 0.211 |
| Florence-2 | 0.035 | 0.169 | 0.205 |
| CLIP ViT-L/14 | 0.034 | 0.168 | 0.197 |
| OWLv2 | 0.034 | 0.169 | 0.197 |
| CoCa | 0.030 | 0.160 | 0.193 |
| File | Encoder | vis_dim |
|---|---|---|
siglip.pt | SigLIP | 1152 |
florence2.pt | Florence-2 | 1024 |
clip-vit-l14.pt | CLIP ViT-L/14 | 1024 |
owlv2.pt | OWLv2 | 1024 |
coca.pt | CoCa | 768 |
1import torch
2import tiktoken
3from lapvqa.rrg.heads import ReportGenerationHead
4
5ckpt = torch.load("siglip.pt", map_location="cpu")
6head = ReportGenerationHead(
7 vis_dim = ckpt["vis_dim"],
8 d_model = ckpt["d_model"],
9 num_layers = ckpt["num_layers"],
10 nhead = ckpt["nhead"],
11)
12head.load_state_dict(ckpt["state_dict"])
13head.eval()
14
15enc = tiktoken.get_encoding("gpt2")
16bos_id = eos_id = enc.eot_token
17
18# vis_tokens: [B, N, vis_dim] — patch tokens from the frozen encoder
19token_ids = head.generate(vis_tokens, bos_id=bos_id, eos_id=eos_id, max_len=150)
20reports = [enc.decode(ids) for ids in token_ids]