rwightman HF staff commited on
Commit
d081641
·
1 Parent(s): a599b5c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +224 -0
README.md CHANGED
@@ -1,3 +1,227 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+ # Model Card for CLIP-convnext_large_d.laion2B-s26B-b102K-augreg
5
+
6
+ # Table of Contents
7
+
8
+ 1. [Model Details](#model-details)
9
+ 2. [Uses](#uses)
10
+ 3. [Training Details](#training-details)
11
+ 4. [Evaluation](#evaluation)
12
+ 5. [Acknowledgements](#acknowledgements)
13
+ 6. [Citation](#citation)
14
+
15
+ # Model Details
16
+
17
+ ## Model Description
18
+
19
+ A series of CLIP [ConvNeXt-Large](https://arxiv.org/abs/2201.03545) (w/ extra text depth, vision MLP head) models trained on subsets LAION-5B (https://laion.ai/blog/laion-5b/) using OpenCLIP (https://github.com/mlfoundations/open_clip).
20
+
21
+ Goals:
22
+ * Explore an alternative to ViT and ResNet (w/ AttentionPooling) CLIP models that scales well with model size and image resolution
23
+
24
+ Firsts:
25
+ * First known ConvNeXt CLIP models trained at scale in the range of CLIP ViT-L/16, ViT-L14, and RN50x16
26
+ * First released model weights exploring increase of augmentation + regularization for image tower via adding (greater scale range of RRC, random erasing, stochastic depth)
27
+
28
+ The models utilize:
29
+ * the [timm](https://github.com/rwightman/pytorch-image-models) ConvNeXt-Large model (`convnext_large`) as the image tower
30
+ * a MLP (`fc - gelu - drop - fc`) head in vision tower instead of the single projection of other CLIP models
31
+ * a text tower with same width but 4 layers more depth than ViT-L / RN50x16 models (depth 16, embed dim 768).
32
+
33
+ The models are trained at 256x256 (working on 384 variants) image resolution.
34
+
35
+ At 256x256, the ConvNext-Large-D used roughly 1/2 the training FLOPs to achieve accuracy greater than previous L/14 model trained on LAION-2B. L/14 model is ~1.65x more GMAC, 1.45x more activations, and 1.22x more parameters. The ConvNeXt was trained with 26B samples-seen and L/14 with 34B.
36
+
37
+ All models in this series were trained for 13B samples and have ImageNet Zero-Shot top-1 of >= 70.8%. Comparing to ViT-B/16 at 34B SS with zero-shot of 70.2% (68.1% for 13B SS) this suggests the ConvNeXt architecture may be more sample efficient in this range of model scale. More experiments needed to confirm.
38
+
39
+ | Model | Dataset | Resolution | AugReg | Top-1 ImageNet Zero-Shot (%) |
40
+ | ----- | ------- | ---------- | ------------ | --------- |
41
+ | [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 |
42
+
43
+ RRC = Random Resize Crop (crop pcts), RE = Random Erasing (prob), SD = Stochastic Depth (prob) -- image tower only, D = Dropout (prob) -- image tower head only
44
+
45
+ LAION-A = LAION Aesthetic, an ~900M sample subset of LAION-2B with pHash dedupe and asthetic score filtering.
46
+
47
+ Model training done by Ross Wightman on the [stability.ai](https://stability.ai/) cluster.
48
+
49
+ # Uses
50
+
51
+ 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.
52
+
53
+ 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.
54
+
55
+ ## Direct Use
56
+
57
+ Zero-shot image classification, image and text retrieval, among others.
58
+
59
+ ## Downstream Use
60
+
61
+ Image classification and other image task fine-tuning, linear probe image classification, image generation guiding and conditioning, among others.
62
+
63
+ ## Out-of-Scope Use
64
+
65
+ As per the OpenAI models,
66
+
67
+ **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.
68
+
69
+ 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.
70
+
71
+ 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.
72
+
73
+ Further the above notice, the LAION-5B dataset used in training of these models has additional considerations, see below.
74
+
75
+ # Training Details
76
+
77
+ ## Training Data
78
+
79
+ This model was trained with one of (see table in intro):
80
+ * LAION-2B - A 2 billion sample English subset of LAION-5B (https://laion.ai/blog/laion-5b/).
81
+ * LAION-Aesthetic - A 900M sample subset of LAION-2B with pHash dedupe and asthetic score filtering
82
+
83
+ **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.
84
+
85
+ ## Training Procedure
86
+
87
+ All models were trained with a global batch size of 102400 for 128 checkpoint intervals of 203.7M samples for a total of ~26B samples seen over training.
88
+
89
+ For 256x256 models, a slurm script w/ srun below was used on 16 8-GPU (A100 80GB) nodes (Stability).
90
+
91
+ ```
92
+ /opt/slurm/sbin/srun --cpu_bind=v --accel-bind=gn python -m training.main \
93
+ --save-frequency 1 \
94
+ --name "convnext_large_256" \
95
+ --resume 'latest' \
96
+ --train-data="pipe:aws s3 cp s3://mybucket/path/{laion{00000..xxxxx}.tar -" \
97
+ --train-num-samples 203666042 \
98
+ --dataset-type webdataset \
99
+ --precision amp_bfloat16 \
100
+ --beta2 0.98 \
101
+ --warmup 10000 \
102
+ --batch-size=800 \
103
+ --epochs=128 \
104
+ --dataset-resampled \
105
+ --clip-grad-norm 5.0 \
106
+ --lr 1.667e-3 \
107
+ --workers=6 \
108
+ --model "convnext_large_d" \
109
+ --seed 0 \
110
+ --ddp-static-graph \
111
+ --local-loss \
112
+ --gather-with-grad \
113
+ --grad-checkpointing
114
+ ```
115
+
116
+
117
+ # Evaluation
118
+
119
+ Evaluation done with code in the [LAION CLIP Benchmark suite](https://github.com/LAION-AI/CLIP_benchmark).
120
+
121
+ ## Testing Data, Factors & Metrics
122
+
123
+ ### Testing Data
124
+
125
+ 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.
126
+
127
+ ## Results
128
+
129
+ The models achieve between 75.9 top-1 zero-shot accuracy on ImageNet-1k.
130
+
131
+ ![](convnext_base_w_zero_shot.png)
132
+
133
+ 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
134
+
135
+ As part of exploring increased augmentation + regularization, early evalations suggest that `augreg` trained models evaluate well over a wider range of resolutions. This is especially true for the 320x320 LAION-A model, where the augreg run was lower than the non-augreg when evaluated at the train resolution of 320x320 (71.3 vs 71.7), but improves to 72.2 when evaluated at 384x384 (the non-augreg drops to 71.0 at 384x384).
136
+
137
+ # Acknowledgements
138
+
139
+ Acknowledging [stability.ai](https://stability.ai/) and the Gauss Centre for Supercomputing e.V. (http://gauss-centre.eu) for funding this part of work by providing computing time through the John von Neumann Institute for Computing (NIC) on the GCS Supercomputer JUWELS Booster at Jülich Supercomputing Centre (JSC).
140
+
141
+ # Citation
142
+
143
+ **BibTeX:**
144
+
145
+ LAION-5B
146
+ ```bibtex
147
+ @inproceedings{schuhmann2022laionb,
148
+ title={{LAION}-5B: An open large-scale dataset for training next generation image-text models},
149
+ author={Christoph Schuhmann and
150
+ Romain Beaumont and
151
+ Richard Vencu and
152
+ Cade W Gordon and
153
+ Ross Wightman and
154
+ Mehdi Cherti and
155
+ Theo Coombes and
156
+ Aarush Katta and
157
+ Clayton Mullis and
158
+ Mitchell Wortsman and
159
+ Patrick Schramowski and
160
+ Srivatsa R Kundurthy and
161
+ Katherine Crowson and
162
+ Ludwig Schmidt and
163
+ Robert Kaczmarczyk and
164
+ Jenia Jitsev},
165
+ booktitle={Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
166
+ year={2022},
167
+ url={https://openreview.net/forum?id=M3Y74vmsMcY}
168
+ }
169
+ ```
170
+
171
+ OpenCLIP software
172
+ ```bibtex
173
+ @software{ilharco_gabriel_2021_5143773,
174
+ author = {Ilharco, Gabriel and
175
+ Wortsman, Mitchell and
176
+ Wightman, Ross and
177
+ Gordon, Cade and
178
+ Carlini, Nicholas and
179
+ Taori, Rohan and
180
+ Dave, Achal and
181
+ Shankar, Vaishaal and
182
+ Namkoong, Hongseok and
183
+ Miller, John and
184
+ Hajishirzi, Hannaneh and
185
+ Farhadi, Ali and
186
+ Schmidt, Ludwig},
187
+ title = {OpenCLIP},
188
+ month = jul,
189
+ year = 2021,
190
+ note = {If you use this software, please cite it as below.},
191
+ publisher = {Zenodo},
192
+ version = {0.1},
193
+ doi = {10.5281/zenodo.5143773},
194
+ url = {https://doi.org/10.5281/zenodo.5143773}
195
+ }
196
+ ```
197
+
198
+ OpenAI CLIP paper
199
+ ```bibtex
200
+ @inproceedings{Radford2021LearningTV,
201
+ title={Learning Transferable Visual Models From Natural Language Supervision},
202
+ 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},
203
+ booktitle={ICML},
204
+ year={2021}
205
+ }
206
+ ```
207
+
208
+ ```bibtex
209
+ @Article{liu2022convnet,
210
+ author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
211
+ title = {A ConvNet for the 2020s},
212
+ journal = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
213
+ year = {2022},
214
+ }
215
+ ```
216
+
217
+ ```bibtex
218
+ @misc{rw2019timm,
219
+ author = {Ross Wightman},
220
+ title = {PyTorch Image Models},
221
+ year = {2019},
222
+ publisher = {GitHub},
223
+ journal = {GitHub repository},
224
+ doi = {10.5281/zenodo.4414861},
225
+ howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
226
+ }
227
+ ```