Mayfull commited on
Commit
3b26125
·
verified ·
1 Parent(s): 353cfa2

Add model card

Browse files
Files changed (1) hide show
  1. README.md +73 -34
README.md CHANGED
@@ -1,55 +1,94 @@
1
  ---
 
2
  library_name: transformers
 
 
 
 
3
  tags:
4
- - generated_from_trainer
5
- datasets:
6
- - coco-karpathy-with-image
7
- model-index:
8
- - name: clip-large-zero-T0.1-P0.5-h3-l1-lr1e-5-250404
9
- results: []
10
  ---
11
 
12
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
- should probably proofread and complete it, then remove this comment. -->
14
 
15
- # clip-large-zero-T0.1-P0.5-h3-l1-lr1e-5-250404
16
 
17
- This model is a fine-tuned version of [](https://huggingface.co/) on the coco-karpathy-with-image dataset.
 
 
18
 
19
- ## Model description
20
 
21
- More information needed
22
 
23
- ## Intended uses & limitations
 
24
 
25
- More information needed
26
 
27
- ## Training and evaluation data
28
 
29
- More information needed
30
 
31
- ## Training procedure
 
 
32
 
33
- ### Training hyperparameters
34
 
35
- The following hyperparameters were used during training:
36
- - learning_rate: 1e-05
37
- - train_batch_size: 256
38
- - eval_batch_size: 8
39
- - seed: 42
40
- - distributed_type: multi-GPU
41
- - optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
42
- - lr_scheduler_type: cosine
43
- - lr_scheduler_warmup_steps: 50
44
- - num_epochs: 5
45
 
46
- ### Training results
 
 
 
 
 
47
 
 
 
48
 
 
 
49
 
50
- ### Framework versions
51
 
52
- - Transformers 4.48.3
53
- - Pytorch 2.6.0+cu124
54
- - Datasets 3.2.0
55
- - Tokenizers 0.21.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
  library_name: transformers
4
+ pipeline_tag: zero-shot-image-classification
5
+ base_model: openai/clip-vit-base-patch32
6
+ language:
7
+ - en
8
  tags:
9
+ - clip
10
+ - vision-language
11
+ - compositional-reasoning
12
+ - contrastive-learning
 
 
13
  ---
14
 
15
+ # READ-CLIP (ViT-B/32)
 
16
 
17
+ **READ-CLIP** is a CLIP model fine-tuned with **READ** (**RE**construction and **A**lignment of text **D**escriptions), a lightweight recipe that strengthens the compositional reasoning of vision–language models. This is the official checkpoint for the NeurIPS 2025 paper *"Enhancing Compositional Reasoning in CLIP via Reconstruction and Alignment of Text Descriptions."*
18
 
19
+ - 📄 **Paper:** [arXiv:2510.16540](https://arxiv.org/abs/2510.16540) (NeurIPS 2025)
20
+ - 💻 **Code:** [github.com/JiH00nKw0n/READ-CLIP](https://github.com/JiH00nKw0n/READ-CLIP)
21
+ - 🧩 **Base model:** [`openai/clip-vit-base-patch32`](https://huggingface.co/openai/clip-vit-base-patch32)
22
 
23
+ ## Method
24
 
25
+ Contrastively trained CLIP models tend to behave like a bag of words, attending to individual tokens rather than the relationships between them. READ adds two auxiliary objectives on top of the standard contrastive loss during fine-tuning:
26
 
27
+ - **Token-level reconstruction** a *frozen* T5 decoder (`google/t5-v1_1-large`) reconstructs related captions from the CLIP text embedding, forcing the embedding to retain word-relationship information.
28
+ - **Sentence-level alignment** — paraphrases of the same caption are pulled together in the embedding space, making representations robust to surface wording.
29
 
30
+ Both objectives are **training-only**. At inference, READ-CLIP is a drop-in `CLIPModel`: no decoder, no extra parameters, and the same compute as the original CLIP.
31
 
32
+ ## Usage
33
 
34
+ The checkpoint loads directly with `transformers` as a standard `CLIPModel`:
35
 
36
+ ```python
37
+ import torch
38
+ from transformers import CLIPModel, CLIPProcessor
39
 
40
+ device = "cuda" if torch.cuda.is_available() else "cpu"
41
 
42
+ model = CLIPModel.from_pretrained("Mayfull/READ-CLIP").to(device)
43
+ processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
 
 
 
 
 
 
 
 
44
 
45
+ inputs = processor(
46
+ text=["a photo of a cat", "a photo of a dog"],
47
+ images=image, # a PIL.Image
48
+ return_tensors="pt",
49
+ padding=True,
50
+ ).to(device)
51
 
52
+ with torch.no_grad():
53
+ outputs = model(**inputs)
54
 
55
+ probs = outputs.logits_per_image.softmax(dim=-1)
56
+ ```
57
 
58
+ ## Results
59
 
60
+ Compositional reasoning accuracy on five standard benchmarks (ViT-B/32 backbone):
61
+
62
+ | Benchmark | READ-CLIP | NegCLIP | FSC-CLIP |
63
+ |---------------------|:---------:|:-------:|:--------:|
64
+ | WhatsUp | **43.9** | 42.4 | 39.8 |
65
+ | VALSE | **76.2** | 73.7 | 74.4 |
66
+ | CREPE | 41.5 | 30.5 | **42.5** |
67
+ | SugarCrepe | **87.0** | 83.6 | 85.2 |
68
+ | SugarCrepe++ (ITT) | **69.8** | 65.0 | 67.9 |
69
+ | SugarCrepe++ (TOT) | **66.2** | 62.5 | 64.4 |
70
+ | **Average** | **64.1** | 59.6 | 62.4 |
71
+
72
+ See the [paper](https://arxiv.org/abs/2510.16540) for the full set of baselines and ablations.
73
+
74
+ ## Training
75
+
76
+ - **Backbone:** `openai/clip-vit-base-patch32` (ViT-B/32)
77
+ - **Data:** MS-COCO (Karpathy training split, ~113K image–caption pairs)
78
+ - **Schedule:** 5 epochs, global batch size 256, AdamW, lr 1e-5 (cosine), weight decay 0.1, bf16
79
+ - **Hardware:** 1× NVIDIA A100 (~2 GPU-hours), seed 2025
80
+
81
+ ## Citation
82
+
83
+ ```bibtex
84
+ @inproceedings{kwon2025readclip,
85
+ title = {Enhancing Compositional Reasoning in {CLIP} via Reconstruction and Alignment of Text Descriptions},
86
+ author = {Kwon, Jihoon and Min, Kyle and Sohn, Jy-yong},
87
+ booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
88
+ year = {2025}
89
+ }
90
+ ```
91
+
92
+ ## License
93
+
94
+ Released under the [MIT License](https://github.com/JiH00nKw0n/READ-CLIP/blob/master/LICENSE).