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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
tags:
|
3 |
+
- zero-shot-image-classification
|
4 |
+
- clip
|
5 |
license: mit
|
6 |
+
library_name: open_clip
|
7 |
+
pipeline_tag: zero-shot-image-classification
|
8 |
---
|
9 |
+
# Model card for CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup
|
10 |
+
|
11 |
+
# Table of Contents
|
12 |
+
|
13 |
+
1. [Model Details](#model-details)
|
14 |
+
2. [Uses](#uses)
|
15 |
+
3. [Training Details](#training-details)
|
16 |
+
4. [Evaluation](#evaluation)
|
17 |
+
5. [Acknowledgements](#acknowledgements)
|
18 |
+
6. [Citation](#citation)
|
19 |
+
|
20 |
+
# Model Details
|
21 |
+
|
22 |
+
## Model Description
|
23 |
+
|
24 |
+
A series of CLIP [ConvNeXt-Large](https://arxiv.org/abs/2201.03545) (w/ extra text depth, vision MLP head) models trained on the LAION-2B (english) subset of [LAION-5B](https://arxiv.org/abs/2210.08402) using [OpenCLIP](https://github.com/mlfoundations/open_clip).
|
25 |
+
|
26 |
+
The models utilize:
|
27 |
+
* the [timm](https://github.com/rwightman/pytorch-image-models) ConvNeXt-Large model (`convnext_large`) as the image tower
|
28 |
+
* a MLP (`fc - gelu - drop - fc`) head in vision tower instead of the single projection of other CLIP models
|
29 |
+
* a text tower with same width but 4 layers more depth than ViT-L / RN50x16 models (depth 16, embed dim 768).
|
30 |
+
|
31 |
+
This 320x320 resolution model is a soup (weight average) of 3 fine-tunes of [CLIP-convnext_large_d.laion2B-s26B-b102K-augreg](https://huggingface.co/laion/CLIP-convnext_large_d.laion2B-s26B-b102K-augreg) at a higher resolution. It is an average of 3 fine-tunes from the final checkpoint of the original 256x256 training run w/ an additional ~2-3B samples for each fine-tune and a lower learning rate. Each fine-tune was a different learning rate (1e-4, 6e-5, 5e-5), and diff # of samples (3.2B, 2B, 2.5B).
|
32 |
+
|
33 |
+
At 320x320, the ConvNext-Large-D is significantly more efficient than the L/14 model at 336x336 that OpenAI fine-tuned. L/14-336 model is 2.5x more GMAC, 2.8x more activations, and 1.22x more parameters.
|
34 |
+
|
35 |
+
| Model | Dataset | Resolution | AugReg | Top-1 ImageNet Zero-Shot (%) |
|
36 |
+
| ----- | ------- | ---------- | ------------ | --------- |
|
37 |
+
| [convnext_large_d.laion2b_s26b_b102k-augreg](https://huggingface.co/laion/CLIP-convnext_large_d.laion2B-s26B-b102K-augreg) | LAION-2B | 256x256 | RRC (0.33, 1.0), RE (0.35), SD (0.1), D(0.1) | 75.9 |
|
38 |
+
| [convnext_large_d_320.laion2b_s29b_b131k-ft](https://huggingface.co/laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft) | LAION-2B | 320x320 | RRC (0.5, 1.0), RE (0.4), SD (0.1), D(0.0) | 76.6 |
|
39 |
+
| [convnext_large_d_320.laion2b_s29b_b131k-ft-soup](https://huggingface.co/laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup) | LAION-2B | 320x320 | RRC (0.5, 1.0), RE (0.4), SD (0.1), D(0.0) | 76.9 |
|
40 |
+
|
41 |
+
RRC = Random Resize Crop (crop pcts), RE = Random Erasing (prob), SD = Stochastic Depth (prob) -- image tower only, D = Dropout (prob) -- image tower head only
|
42 |
+
|
43 |
+
LAION-A = LAION Aesthetic, an ~900M sample subset of LAION-2B with pHash dedupe and asthetic score filtering.
|
44 |
+
|
45 |
+
Model training done by Ross Wightman on the [stability.ai](https://stability.ai/) cluster.
|
46 |
+
|
47 |
+
# Uses
|
48 |
+
|
49 |
+
As per the original [OpenAI CLIP model card](https://github.com/openai/CLIP/blob/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1/model-card.md), this model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such model.
|
50 |
+
|
51 |
+
The OpenAI CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis. Additionally, the LAION-5B blog (https://laion.ai/blog/laion-5b/) and upcoming paper include additional discussion as it relates specifically to the training dataset.
|
52 |
+
|
53 |
+
## Direct Use
|
54 |
+
|
55 |
+
Zero-shot image classification, image and text retrieval, among others.
|
56 |
+
|
57 |
+
## Downstream Use
|
58 |
+
|
59 |
+
Image classification and other image task fine-tuning, linear probe image classification, image generation guiding and conditioning, among others.
|
60 |
+
|
61 |
+
## Out-of-Scope Use
|
62 |
+
|
63 |
+
As per the OpenAI models,
|
64 |
+
|
65 |
+
**Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
|
66 |
+
|
67 |
+
Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
|
68 |
+
|
69 |
+
Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
|
70 |
+
|
71 |
+
Further the above notice, the LAION-5B dataset used in training of these models has additional considerations, see below.
|
72 |
+
|
73 |
+
# Training Details
|
74 |
+
|
75 |
+
## Training Data
|
76 |
+
|
77 |
+
This model was trained with LAION-2B -- A 2 billion sample English subset of LAION-5B (https://laion.ai/blog/laion-5b/).
|
78 |
+
|
79 |
+
**IMPORTANT NOTE:** The motivation behind dataset creation is to democratize research and experimentation around large-scale multi-modal model training and handling of uncurated, large-scale datasets crawled from publically available internet. Our recommendation is therefore to use the dataset for research purposes. Be aware that this large-scale dataset is uncurated. Keep in mind that the uncurated nature of the dataset means that collected links may lead to strongly discomforting and disturbing content for a human viewer. Therefore, please use the demo links with caution and at your own risk. It is possible to extract a “safe” subset by filtering out samples based on the safety tags (using a customized trained NSFW classifier that we built). While this strongly reduces the chance for encountering potentially harmful content when viewing, we cannot entirely exclude the possibility for harmful content being still present in safe mode, so that the warning holds also there. We think that providing the dataset openly to broad research and other interested communities will allow for transparent investigation of benefits that come along with training large-scale models as well as pitfalls and dangers that may stay unreported or unnoticed when working with closed large datasets that remain restricted to a small community. Providing our dataset openly, we however do not recommend using it for creating ready-to-go industrial products, as the basic research about general properties and safety of such large-scale models, which we would like to encourage with this release, is still in progress.
|
80 |
+
|
81 |
+
## Training Procedure
|
82 |
+
|
83 |
+
All 320x320 model fine-tunes were trained with a global batch size of 131072 for 10-16 checkpoint intervals of 203.7M samples for a total of ~2-3B samples seen over fine-tune.
|
84 |
+
|
85 |
+
For 320x320 models, a slurm script w/ srun below was used on 64 8-GPU (A100 40GB) nodes (Stability).
|
86 |
+
|
87 |
+
```
|
88 |
+
/opt/slurm/sbin/srun --cpu_bind=v --accel-bind=gn python -m training.main \
|
89 |
+
--save-frequency 1 \
|
90 |
+
--name "convnext_large_320" \
|
91 |
+
--pretrained ""/runs/convnext_large_256/epoch_128.pt" \
|
92 |
+
--resume 'latest' \
|
93 |
+
--train-data="pipe:aws s3 cp s3://mybucket/path/{laion{00000..xxxxx}.tar -" \
|
94 |
+
--train-num-samples 203666042 \
|
95 |
+
--dataset-type webdataset \
|
96 |
+
--precision amp_bfloat16 \
|
97 |
+
--beta2 0.98 \
|
98 |
+
--warmup 2000 \
|
99 |
+
--batch-size=256 \
|
100 |
+
--epochs=12 \
|
101 |
+
--dataset-resampled \
|
102 |
+
--aug-cfg use_timm=True scale='(0.5, 1.0)' re_prob=0.4 \
|
103 |
+
--clip-grad-norm 5.0 \
|
104 |
+
--lr 5e-5 \
|
105 |
+
--workers=6 \
|
106 |
+
--model "convnext_large_d_320" \
|
107 |
+
--seed 0 \
|
108 |
+
--ddp-static-graph \
|
109 |
+
--local-loss \
|
110 |
+
--gather-with-grad \
|
111 |
+
--grad-checkpointing
|
112 |
+
```
|
113 |
+
|
114 |
+
# Evaluation
|
115 |
+
|
116 |
+
Evaluation done with code in the [LAION CLIP Benchmark suite](https://github.com/LAION-AI/CLIP_benchmark).
|
117 |
+
|
118 |
+
## Testing Data, Factors & Metrics
|
119 |
+
|
120 |
+
### Testing Data
|
121 |
+
|
122 |
+
The testing is performed with VTAB+ (A combination of VTAB (https://arxiv.org/abs/1910.04867) w/ additional robustness datasets) for classification and COCO and Flickr for retrieval.
|
123 |
+
|
124 |
+
## Results
|
125 |
+
|
126 |
+
The models achieve between 75.9 and 76.9 top-1 zero-shot accuracy on ImageNet-1k.
|
127 |
+
|
128 |
+
Zero-shot curve of origina from-scratch 256x256 training:
|
129 |
+
![](convnext_large_zero_shot.png)
|
130 |
+
|
131 |
+
An initial round of benchmarks have been performed on a wider range of datasets, to be viewable at https://github.com/LAION-AI/CLIP_benchmark/blob/main/benchmark/results.ipynb
|
132 |
+
|
133 |
+
# Acknowledgements
|
134 |
+
|
135 |
+
Acknowledging [stability.ai](https://stability.ai/) for compute used to train this model.
|
136 |
+
|
137 |
+
# Citation
|
138 |
+
|
139 |
+
**BibTeX:**
|
140 |
+
|
141 |
+
LAION-5B
|
142 |
+
```bibtex
|
143 |
+
@inproceedings{schuhmann2022laionb,
|
144 |
+
title={{LAION}-5B: An open large-scale dataset for training next generation image-text models},
|
145 |
+
author={Christoph Schuhmann and
|
146 |
+
Romain Beaumont and
|
147 |
+
Richard Vencu and
|
148 |
+
Cade W Gordon and
|
149 |
+
Ross Wightman and
|
150 |
+
Mehdi Cherti and
|
151 |
+
Theo Coombes and
|
152 |
+
Aarush Katta and
|
153 |
+
Clayton Mullis and
|
154 |
+
Mitchell Wortsman and
|
155 |
+
Patrick Schramowski and
|
156 |
+
Srivatsa R Kundurthy and
|
157 |
+
Katherine Crowson and
|
158 |
+
Ludwig Schmidt and
|
159 |
+
Robert Kaczmarczyk and
|
160 |
+
Jenia Jitsev},
|
161 |
+
booktitle={Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
|
162 |
+
year={2022},
|
163 |
+
url={https://openreview.net/forum?id=M3Y74vmsMcY}
|
164 |
+
}
|
165 |
+
```
|
166 |
+
|
167 |
+
OpenCLIP software
|
168 |
+
```bibtex
|
169 |
+
@software{ilharco_gabriel_2021_5143773,
|
170 |
+
author = {Ilharco, Gabriel and
|
171 |
+
Wortsman, Mitchell and
|
172 |
+
Wightman, Ross and
|
173 |
+
Gordon, Cade and
|
174 |
+
Carlini, Nicholas and
|
175 |
+
Taori, Rohan and
|
176 |
+
Dave, Achal and
|
177 |
+
Shankar, Vaishaal and
|
178 |
+
Namkoong, Hongseok and
|
179 |
+
Miller, John and
|
180 |
+
Hajishirzi, Hannaneh and
|
181 |
+
Farhadi, Ali and
|
182 |
+
Schmidt, Ludwig},
|
183 |
+
title = {OpenCLIP},
|
184 |
+
month = jul,
|
185 |
+
year = 2021,
|
186 |
+
note = {If you use this software, please cite it as below.},
|
187 |
+
publisher = {Zenodo},
|
188 |
+
version = {0.1},
|
189 |
+
doi = {10.5281/zenodo.5143773},
|
190 |
+
url = {https://doi.org/10.5281/zenodo.5143773}
|
191 |
+
}
|
192 |
+
```
|
193 |
+
|
194 |
+
```
|
195 |
+
@InProceedings{pmlr-v162-wortsman22a,
|
196 |
+
title = {Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time},
|
197 |
+
author = {Wortsman, Mitchell and Ilharco, Gabriel and Gadre, Samir Ya and Roelofs, Rebecca and Gontijo-Lopes, Raphael and Morcos, Ari S and Namkoong, Hongseok and Farhadi, Ali and Carmon, Yair and Kornblith, Simon and Schmidt, Ludwig},
|
198 |
+
booktitle = {Proceedings of the 39th International Conference on Machine Learning},
|
199 |
+
pages = {23965--23998},
|
200 |
+
year = {2022},
|
201 |
+
editor = {Chaudhuri, Kamalika and Jegelka, Stefanie and Song, Le and Szepesvari, Csaba and Niu, Gang and Sabato, Sivan},
|
202 |
+
volume = {162},
|
203 |
+
series = {Proceedings of Machine Learning Research},
|
204 |
+
month = {17--23 Jul},
|
205 |
+
publisher = {PMLR},
|
206 |
+
pdf = {https://proceedings.mlr.press/v162/wortsman22a/wortsman22a.pdf},
|
207 |
+
url = {https://proceedings.mlr.press/v162/wortsman22a.html}
|
208 |
+
}
|
209 |
+
```
|
210 |
+
|
211 |
+
OpenAI CLIP paper
|
212 |
+
```bibtex
|
213 |
+
@inproceedings{Radford2021LearningTV,
|
214 |
+
title={Learning Transferable Visual Models From Natural Language Supervision},
|
215 |
+
author={Alec Radford and Jong Wook Kim and Chris Hallacy and A. Ramesh and Gabriel Goh and Sandhini Agarwal and Girish Sastry and Amanda Askell and Pamela Mishkin and Jack Clark and Gretchen Krueger and Ilya Sutskever},
|
216 |
+
booktitle={ICML},
|
217 |
+
year={2021}
|
218 |
+
}
|
219 |
+
```
|
220 |
+
|
221 |
+
```bibtex
|
222 |
+
@Article{liu2022convnet,
|
223 |
+
author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
|
224 |
+
title = {A ConvNet for the 2020s},
|
225 |
+
journal = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
226 |
+
year = {2022},
|
227 |
+
}
|
228 |
+
```
|
229 |
+
|
230 |
+
```bibtex
|
231 |
+
@misc{rw2019timm,
|
232 |
+
author = {Ross Wightman},
|
233 |
+
title = {PyTorch Image Models},
|
234 |
+
year = {2019},
|
235 |
+
publisher = {GitHub},
|
236 |
+
journal = {GitHub repository},
|
237 |
+
doi = {10.5281/zenodo.4414861},
|
238 |
+
howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
|
239 |
+
}
|
240 |
+
```
|