README.md CHANGED
@@ -15,60 +15,24 @@ datasets:
15
 
16
  TODO: logo?
17
 
18
- # Model Card for m4-80b
19
-
20
- <!-- Provide a quick summary of what the model is/does. [Optional] -->
21
- IDEFICS (**I**mage-aware **D**ecoder **E**nhanced à la **F**lamingo with **I**nterleaved **C**ross-attention**S**) is an open-access reproduction of Flamingo, a closed-source visual language model developed by Deepmind. The multimodal model accepts arbitrary sequences of image and text inputs and produces text outputs and is built solely on public available data and models.
22
- IDEFICS (TODO) is on par with the original model on various image + text benchmarks, including visual question answering (open-ended and multiple choice), image captioning, and image classification when evaluated with in-context few-shot learning.
23
-
24
- The model comes into two variants: a large [80 billion parameters version](https://huggingface.co/HuggingFaceM4/m4-80b) and a [9 billion parameters version](https://huggingface.co/HuggingFaceM4/m4-9b).
25
- We also fine-tune these base models on a mixture of SFT datasets (TODO: find a more understandable characterization), which boosts the downstream performance while making the models more usable in conversational settings: (TODO: 80B-sfted) and (TODO: 9B sfted).
26
-
27
-
28
- # Table of Contents
29
-
30
- - [Model Card for m4-80b](#model-card-for--model_id-)
31
- - [Table of Contents](#table-of-contents)
32
- - [Model Details](#model-details)
33
- - [Model Description](#model-description)
34
- - [Uses](#uses)
35
- - [Direct Use](#direct-use)
36
- - [Downstream Use [Optional]](#downstream-use-optional)
37
- - [Out-of-Scope Use](#out-of-scope-use)
38
- - [Bias, Risks, and Limitations](#bias-risks-and-limitations)
39
- - [Recommendations](#recommendations)
40
- - [Training Details](#training-details)
41
- - [Training Data](#training-data)
42
- - [Training Procedure](#training-procedure)
43
- - [Preprocessing](#preprocessing)
44
- - [Speeds, Sizes, Times](#speeds-sizes-times)
45
- - [Evaluation](#evaluation)
46
- - [Testing Data, Factors & Metrics](#testing-data-factors--metrics)
47
- - [Testing Data](#testing-data)
48
- - [Factors](#factors)
49
- - [Metrics](#metrics)
50
- - [Results](#results)
51
- - [Model Examination](#model-examination)
52
- - [Environmental Impact](#environmental-impact)
53
- - [Technical Specifications [optional]](#technical-specifications-optional)
54
- - [Model Architecture and Objective](#model-architecture-and-objective)
55
- - [Compute Infrastructure](#compute-infrastructure)
56
- - [Hardware](#hardware)
57
- - [Software](#software)
58
- - [Citation](#citation)
59
- - [Glossary [optional]](#glossary-optional)
60
- - [More Information [optional]](#more-information-optional)
61
- - [Model Card Authors [optional]](#model-card-authors-optional)
62
- - [Model Card Contact](#model-card-contact)
63
- - [How to Get Started with the Model](#how-to-get-started-with-the-model)
64
 
 
 
 
 
 
 
 
 
 
65
 
66
  # Model Details
67
 
68
  - **Developed by:** Hugging Face
69
- - **Model type:** Multi-modal model (text+image)
70
  - **Language(s) (NLP):** en
71
- - **License:** other
72
  - **Parent Model:** [laion/CLIP-ViT-H-14-laion2B-s32B-b79K](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) and [huggyllama/llama-65b](https://huggingface.co/huggyllama/llama-65b)
73
  - **Resources for more information:**
74
  - [GitHub Repo](https://github.com/huggingface/m4/)
@@ -77,41 +41,63 @@ We also fine-tune these base models on a mixture of SFT datasets (TODO: find a m
77
  - Original Paper: [Flamingo: a Visual Language Model for Few-Shot Learning](https://huggingface.co/papers/2204.14198)
78
 
79
  IDEFICS is a large multimodal English model that takes sequences of interleaved images and texts as inputs and generates text outputs.
80
- The model shows strong in-context few-shot learning capabilities (and on par with the closed-source model), and is a robust starting point to fine-tune multimodal models on custom data.
81
 
82
  IDEFICS is built on top of two unimodal open-access pre-trained models to connect the two modalities. Newly initialized parameters in the form of Transformer blocks bridge the gap between the vision encoder and the language model. The model is trained on a mixture of image/text pairs and unstrucutred multimodal web documents.
83
 
 
84
 
85
  # Uses
86
 
87
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
88
-
89
  The model can be used to perform inference on multimodal (image + text) tasks in which the input is composed of a text query/instruction along with one or multiple images. This model does not support image generation.
90
 
91
- It is possible to fine-tune the base model on custom data for a specific use-case. We note that the instruction-fine-tuned models are significantly better at following instructions and thus should be prefered when using the models out-of-the-box.
92
 
93
- The following screenshot is an example of interaction with the model:
94
 
95
- TODO: screenshot
96
 
97
 
98
  # How to Get Started with the Model
99
 
100
  Use the code below to get started with the model.
101
 
102
- <details>
103
- <summary> Click to expand </summary>
 
 
 
104
 
105
- More information needed
 
 
106
 
107
- </details>
 
 
 
 
 
 
108
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  To quickly test your software without waiting for the huge model to download/load you can use `HuggingFaceM4/tiny-random-idefics` - it hasn't been trained and has random weights but it is very useful for quick testing.
111
 
 
 
112
  # Training Details
113
 
114
- We closel follow the training procedure layed out in [Flamingo](https://huggingface.co/papers/2204.14198). We combine two open-source pre-trained models ([laion/CLIP-ViT-H-14-laion2B-s32B-b79K](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) and [huggyllama/llama-65b](https://huggingface.co/huggyllama/llama-65b)) by initializing new Transformer blocks. The pre-trained backbones are frozen while we train the newly initialized parameters.
115
 
116
  The model is trained on the following data mixture of openly accessible English data:
117
 
@@ -119,20 +105,20 @@ The model is trained on the following data mixture of openly accessible English
119
  |-------------|-----------------------------------------|---------------------------|---------------------------|--------|-----------------------------------------|
120
  | [OBELICS](https://huggingface.co/datasets/HuggingFaceM4/OBELICS) | Unstructured Multimodal Web Documents | 114.9B | 353M | 1 | 73.85% |
121
  | [Wikipedia](https://huggingface.co/datasets/wikipedia) | Unstructured Multimodal Web Documents | 3.192B | 39M | 3 | 6.15% |
122
- | [LAION](https://huggingface.co/datasets/laion/laion2B-en) | Image-Text Pairs | 29.9B | 1.120B | 1 | 17.18%
123
  | [PMD](https://huggingface.co/datasets/facebook/pmd) | Image-Text Pairs | 1.6B | 70M | 3 | 2.82% | |
124
 
125
- **OBELICS** is an open, massive and curated collection of interleaved image-text web documents, containing 141M documents, 115B text tokens and 353M images. An interactive visualization of the dataset content is available [here](TODO). (https://atlas.nomic.ai/map/259c207e-a228-445b-af77-281c84f8bd52/1211f37e-6c31-4dab-80ba-fdb02dfc1a51 -> this is an early, non-final version)
126
 
127
- **Wkipedia** is the multimodal equivalent of the encyclopedia. We used the English dump of Wikipedia created on February 20th, 2023.
128
 
129
- **LAION** is a collection of image-text pairs collected from web pages from Common Crawl and texts are obtained using the alternative texts of each image. We deduplicated it (following [this paper](https://arxiv.org/abs/2303.12733)), slightly filtered it, and removed the opted-out images.
130
 
131
  **PMD** is a collection of publicly-available image-text pair datasets. The dataset contains pairs from Conceptual Captions, Conceptual Captions 12M, WIT, Localized Narratives, RedCaps, COCO, SBU Captions, Visual Genome and a subset of YFCC100M dataset. Due to a server failure at the time of the pre-processing, we did not include SBU captions.
132
 
133
  For multimodal web documents, we feed the model sequences corresponding to the succession of text paragraphs and images. For image-text pairs, we form the training sequences by packing images with their captions. The images are encoded with the vision encoder and vision hidden states are pooled with Transformer Perceiver blocks and then fused into the text sequence through the cross-attention blocks.
134
 
135
- Following (Dehghani et al., 2023)[https://huggingface.co/papers/2302.05442], we apply a layer normalization on the projected queries and keys of both the Perceiver and cross-attention blocks, which improved training stability in our early experiments. We use the [RMSNorm](https://huggingface.co/papers/1910.07467) implementation for trainable Layer Norms.
136
 
137
  The training objective is the standard next token prediction.
138
 
@@ -164,16 +150,19 @@ We use the following hyper and training parameters:
164
 
165
  # Evaluation
166
 
167
- <!-- This section describes the evaluation protocols and provides the results. -->
168
- We closely follow the evaluation protocol of Flamingo and evaluate IDEFICS on a suite of downstream image + text benchmarks ranging from visual question answering to image captioning.
169
 
170
  We compare our model to the original Flamingo along with [OpenFlamingo](openflamingo/OpenFlamingo-9B-vitl-mpt7b), another open-source reproduction.
171
 
172
- We perform checkpoint selection based on validation sets of TODO, and select the checkpoint at step 65'000 for IDEFICS-9B and at step 37'500 for IDEFICS. The models are evaluated with in-context few-shot learning where the priming instances are selected from a support set to be similar (i.e. close in a vector space) to the queried instance. We do not use any form of ensembling.
173
 
174
- TODO: beautiful plots of shots scaling laws.
175
 
176
- | Model | Shots | VQAv2 (OE VQA acc) | OKVQA (OE VQA acc) | TextVQA (OE VQA acc) | VizWiz (OE VQA acc) | TextCaps (CIDEr) | Coco (CIDEr) | NoCaps (CIDEr) | Flickr (CIDEr) | VisDial (NDCG) | HatefulMemes (ROC AUC) | ScienceQA (accuracy) | RenderedSST2 (accuracy) | Winoground (group (text/image)) |
 
 
 
 
177
  |:-----------|--------:|---------------------:|---------------------:|-----------------------:|----------------------:|-------------------:|---------------:|-----------------:|-----------------:|-----------------:|-------------------------:|-----------------------:|--------------------------:|----------------------------------:|
178
  | IDEFIX 80B | 0 | 60.0 | 45.2 | 30.9 | 36.0 | 56.8 | 91.8 | 65.0 | 53.7 | 48.8 | 60.6 | 68.9 | 60.5 | 8.0 (18.8/22.5) |
179
  | | 4 | 63.6 | 52.4 | 34.4 | 40.4 | 72.7 | 110.3 | 99.6 | 73.7 | 48.4 | 57.8 | 58.9 | 66.6 | - |
@@ -187,14 +176,15 @@ TODO: beautiful plots of shots scaling laws.
187
  | | 16 | 57.0 | 48.4 | 27.9 | 42.6 | 67.4 | 99.7 | 89.4 | 64.5 | - | 50.9 | - | 67.8 | - |
188
  | | 32 | 57.9 | 49.6 | 28.3 | 43.7 | 68.1 | 98.0 | 90.5 | 64.4 | - | 49.8 | - | 67.0 | - |
189
 
190
- Imagenet Evaluation:
191
- | Model | Shots | Imagenet |
192
- |:-----------|--------:|-----------:|
193
- | IDEFIX 80B | 16, 1k support set | 65.4 |
194
- | | 16, RICES 5k support set | 72.9 |
 
195
  <br>
196
- | IDEFIX 9B | 16, 1k support set | 53.5 |
197
- | | 16, RICES 5k support set | 64.5 |
198
 
199
  Fairness Evaluations:
200
  | Model | Shots | FairFaceGender (accuracy) | FairFaceRace (accuracy) | FairFaceAge (accuracy) |
@@ -204,21 +194,25 @@ Fairness Evaluations:
204
  | | 8 | 95.5 | 52.3 | 53.1 |
205
  | | 16 | 95.7 | 47.6 | 52.8 |
206
  | | 32 | 95.7 | 36.5 | 51.2 |
207
- <br>
208
  | IDEFIX 9B | 0 | 94.4 | 55.3 | 45.1 |
209
  | | 4 | 93.9 | 35.3 | 44.3 |
210
  | | 8 | 95.4 | 44.7 | 46.0 |
211
  | | 16 | 95.8 | 43.0 | 46.1 |
212
  | | 32 | 96.1 | 35.1 | 44.9 |
213
 
 
 
214
  # Technical Specifications
215
 
 
 
 
 
216
  ## Hardware
217
 
218
  The training was performed on an AWS SageMaker cluster with 64 nodes of 8x80GB A100 GPUs (512 GPUs total). The cluster uses the current EFA network which provides about 340GBps throughput.
219
 
220
- As the network is quite slow for the needs of DeepSpeed ZeRO-3 we were only able to clock ~90 TFLOPs.
221
-
222
  ## Software
223
 
224
  The training software is built on top of HuggingFace Transformers + Accelerate, and DeepSpeed ZeRO-3 for training, and [WebDataset](https://github.com/webdataset/webdataset) for data loading.
@@ -226,8 +220,6 @@ The training software is built on top of HuggingFace Transformers + Accelerate,
226
 
227
  # Bias, Risks, and Limitations
228
 
229
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
230
-
231
  Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)).
232
  As a derivative of such a language model, IDEFICS can produce texts that include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
233
  Moreover, IDEFICS can produce factually incorrect texts, and should not be relied on to produce factually accurate information.
@@ -238,35 +230,28 @@ TODO: give 4/5 representative examples
238
  To measure IDEFICS's ability to recognize socilogical (TODO: find a better adjective) attributes, we evaluate the model on FairFace...
239
  TODO: include FairFace numbers
240
 
 
241
 
242
- # Environmental Impact
243
-
244
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
245
-
246
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
247
-
248
- - **Hardware Type:** 64 nodes of 8x 80GB A100 gpus, EFA network
249
- - **Hours used:** ~672 node hours
250
- - **Cloud Provider:** AWS Sagemaker
251
- - **Carbon Emitted:** unknown
252
 
 
253
 
254
  # Citation
255
 
256
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
257
-
258
  **BibTeX:**
259
 
260
- More information needed
261
-
262
- **APA:**
263
-
264
- More information needed
265
-
266
-
267
- # Model Card Authors [optional]
268
-
269
- <!-- This section provides another layer of transparency and accountability. Whose views is this model card representing? How many voices were included in its construction? Etc. -->
 
 
270
 
271
  V, i, c, t, o, r, ,, , S, t, a, s, ,, , X, X, X
272
 
 
15
 
16
  TODO: logo?
17
 
18
+ # IDEFICS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ IDEFICS (**I**mage-aware **D**ecoder **E**nhanced à la **F**lamingo with **I**nterleaved **C**ross-attention**S**) is an open-access reproduction of [Flamingo](https://huggingface.co/papers/2204.14198), a closed-source visual language model developed by Deepmind. Like GPT-4, the multimodal model accepts arbitrary sequences of image and text inputs and produces text outputs. IDEFICS is built solely on public available data and models.
21
+
22
+ The model can answer questions about images, describe visual contents, create stories grounded on multiple images, or simply behave as a pure language model without visual inputs.
23
+
24
+ IDEFICS is on par with the original model on various image-text benchmarks, including visual question answering (open-ended and multiple choice), image captioning, and image classification when evaluated with in-context few-shot learning. It comes into two variants: a large [80 billion parameters](https://huggingface.co/HuggingFaceM4/idefics-80b) version and a [9 billion parameters](https://huggingface.co/HuggingFaceM4/idefics-9b) version.
25
+
26
+ We also fine-tune these base models on a mixture of supervised and instruction fine-tuning datasets, which boosts the downstream performance while making the models more usable in conversational settings: [idefics-80b-instruct](https://huggingface.co/HuggingFaceM4/idefics-80b-instruct) and [idefics-9b-instruct](https://huggingface.co/HuggingFaceM4/idefics-9b-instruct). As they reach higher performance, we recommend using these instructed versions first.
27
+
28
+ Read more about some of the technical challenges encountered during training IDEFICS [here](https://github.com/huggingface/m4-logs/blob/master/memos/README.md).
29
 
30
  # Model Details
31
 
32
  - **Developed by:** Hugging Face
33
+ - **Model type:** Multi-modal model (image+text)
34
  - **Language(s) (NLP):** en
35
+ - **License:** see [License section](#license)
36
  - **Parent Model:** [laion/CLIP-ViT-H-14-laion2B-s32B-b79K](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) and [huggyllama/llama-65b](https://huggingface.co/huggyllama/llama-65b)
37
  - **Resources for more information:**
38
  - [GitHub Repo](https://github.com/huggingface/m4/)
 
41
  - Original Paper: [Flamingo: a Visual Language Model for Few-Shot Learning](https://huggingface.co/papers/2204.14198)
42
 
43
  IDEFICS is a large multimodal English model that takes sequences of interleaved images and texts as inputs and generates text outputs.
44
+ The model shows strong in-context few-shot learning capabilities and is on par with the closed-source model. This makes IDEFICS a robust starting point to fine-tune multimodal models on custom data.
45
 
46
  IDEFICS is built on top of two unimodal open-access pre-trained models to connect the two modalities. Newly initialized parameters in the form of Transformer blocks bridge the gap between the vision encoder and the language model. The model is trained on a mixture of image/text pairs and unstrucutred multimodal web documents.
47
 
48
+ IDEFICS-instruct is the model obtained by further training IDEFICS on Supervised Fine-Tuning and Instruction Fine-Tuning datasets. This improves downstream performance significantly (making [idefics-9b-instruct](https://huggingface.co/HuggingFaceM4/idefics-9b-instruct) a very strong model at its 9 billion scale), while making the model more suitable to converse with.
49
 
50
  # Uses
51
 
 
 
52
  The model can be used to perform inference on multimodal (image + text) tasks in which the input is composed of a text query/instruction along with one or multiple images. This model does not support image generation.
53
 
54
+ It is possible to fine-tune the base model on custom data for a specific use-case. We note that the instruction-fine-tuned models are significantly better at following instructions from users and thus should be prefered when using the models out-of-the-box.
55
 
56
+ The following screenshot is an example of interaction with the instructed model:
57
 
58
+ <img src="./assets/guarding_baguettes.png" width="35%">
59
 
60
 
61
  # How to Get Started with the Model
62
 
63
  Use the code below to get started with the model.
64
 
65
+ ```python
66
+ import torch
67
+ from transformers import IdeficsForVisionText2Text, AutoProcessor
68
+
69
+ device = "cuda" if torch.cuda.is_available() else "cpu"
70
 
71
+ checkpoint = "HuggingFaceM4/idefics-9b"
72
+ model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16).to(device)
73
+ processor = AutoProcessor.from_pretrained(checkpoint)
74
 
75
+ # We feed to the model an arbitrary sequence of text strings and images. Images can be either URLs or PIL Images.
76
+ prompts = [
77
+ [
78
+ "https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG",
79
+ "In this picture from Asterix and Obelix, we can see"
80
+ ],
81
+ ]
82
 
83
+ # --batched mode
84
+ inputs = processor(prompts, return_tensors="pt").to(device)
85
+ # --single sample mode
86
+ # inputs = processor(prompts[0], return_tensors="pt").to(device)
87
+
88
+ generated_ids = model.generate(**inputs, max_length=100)
89
+ generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
90
+ for i, t in enumerate(generated_text):
91
+ print(f"{i}:\n{t}\n")
92
+ ```
93
 
94
  To quickly test your software without waiting for the huge model to download/load you can use `HuggingFaceM4/tiny-random-idefics` - it hasn't been trained and has random weights but it is very useful for quick testing.
95
 
96
+ This [tutorial](https://github.com/huggingface/notebooks/pull/418/) shows a simple example to fine-tune IDEFICS on custom data. This [colab notebook](TODO) showcases how to do the fine-tuning in 4bits precision. TODO: change to the correct link once it's merged.
97
+
98
  # Training Details
99
 
100
+ We closely follow the training procedure layed out in [Flamingo](https://huggingface.co/papers/2204.14198). We combine two open-source pre-trained models ([laion/CLIP-ViT-H-14-laion2B-s32B-b79K](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) and [huggyllama/llama-65b](https://huggingface.co/huggyllama/llama-65b)) by initializing new Transformer blocks. The pre-trained backbones are frozen while we train the newly initialized parameters.
101
 
102
  The model is trained on the following data mixture of openly accessible English data:
103
 
 
105
  |-------------|-----------------------------------------|---------------------------|---------------------------|--------|-----------------------------------------|
106
  | [OBELICS](https://huggingface.co/datasets/HuggingFaceM4/OBELICS) | Unstructured Multimodal Web Documents | 114.9B | 353M | 1 | 73.85% |
107
  | [Wikipedia](https://huggingface.co/datasets/wikipedia) | Unstructured Multimodal Web Documents | 3.192B | 39M | 3 | 6.15% |
108
+ | [LAION](https://huggingface.co/datasets/laion/laion2B-en) | Image-Text Pairs | 29.9B | 1.120B | 1 | 17.18%
109
  | [PMD](https://huggingface.co/datasets/facebook/pmd) | Image-Text Pairs | 1.6B | 70M | 3 | 2.82% | |
110
 
111
+ **OBELICS** is an open, massive and curated collection of interleaved image-text web documents, containing 141M documents, 115B text tokens and 353M images. An interactive visualization of the dataset content is available [here](https://atlas.nomic.ai/map/f2fba2aa-3647-4f49-a0f3-9347daeee499/ee4a84bd-f125-4bcc-a683-1b4e231cb10f).
112
 
113
+ **Wkipedia**. We used the English dump of Wikipedia created on February 20th, 2023.
114
 
115
+ **LAION** is a collection of image-text pairs collected from web pages from Common Crawl and texts are obtained using the alternative texts of each image. We deduplicated it (following [Webster et al., 2023](https://arxiv.org/abs/2303.12733)), filtered it, and removed the opted-out images using the [Spawning API](https://api.spawning.ai/spawning-api).
116
 
117
  **PMD** is a collection of publicly-available image-text pair datasets. The dataset contains pairs from Conceptual Captions, Conceptual Captions 12M, WIT, Localized Narratives, RedCaps, COCO, SBU Captions, Visual Genome and a subset of YFCC100M dataset. Due to a server failure at the time of the pre-processing, we did not include SBU captions.
118
 
119
  For multimodal web documents, we feed the model sequences corresponding to the succession of text paragraphs and images. For image-text pairs, we form the training sequences by packing images with their captions. The images are encoded with the vision encoder and vision hidden states are pooled with Transformer Perceiver blocks and then fused into the text sequence through the cross-attention blocks.
120
 
121
+ Following [Dehghani et al., 2023](https://huggingface.co/papers/2302.05442), we apply a layer normalization on the projected queries and keys of both the Perceiver and cross-attention blocks, which improved training stability in our early experiments. We use the [RMSNorm](https://huggingface.co/papers/1910.07467) implementation for trainable Layer Norms.
122
 
123
  The training objective is the standard next token prediction.
124
 
 
150
 
151
  # Evaluation
152
 
153
+ We follow the evaluation protocol of Flamingo and evaluate IDEFICS on a suite of downstream image-text benchmarks ranging from visual question answering to image captioning.
 
154
 
155
  We compare our model to the original Flamingo along with [OpenFlamingo](openflamingo/OpenFlamingo-9B-vitl-mpt7b), another open-source reproduction.
156
 
157
+ We perform checkpoint selection based on validation sets of VQAv2, TextVQA, OKVQA, VizWiz, Visual Dialogue, Coco, Flickr30k, and HatefulMemes. We select the checkpoint at step 65'000 for IDEFICS-9B and at step 37'500 for IDEFICS. The models are evaluated with in-context few-shot learning where the priming instances are selected at random from a support set. We do not use any form of ensembling.
158
 
159
+ As opposed to Flamingo, we did not train IDEFICS on video-text pairs datasets, and as such, we did not evaluate the model on video-text benchmarks like Flamingo did. We leave that evaluation for a future iteration.
160
 
161
+ <img src="./assets/Figure_Evals_IDEFIX.png" width="55%">
162
+
163
+ We note that since IDEFICS was trained on PMD (which contains COCO), the evaluation numbers on COCO are not directly comparable with Flamingo and OpenFlamingo since they did not explicitely have this dataset in the training mixture. Additionally, Flamingo is trained with images of resolution 320 x 320 while IDEFICS and OpenFlamingo were trained with images of 224 x 224 resolution.
164
+
165
+ | Model | Shots | VQAv2<br>OE VQA acc.<br> | OKVQA<br>OE VQA acc.<br> | TextVQA<br>OE VQA acc.<br> | VizWiz<br>OE VQA acc.<br> | TextCaps<br>CIDEr<br> | Coco<br>CIDEr<br> | NoCaps<br>CIDEr | Flickr<br>CIDEr | VisDial<br>NDCG | HatefulMemes<br>ROC AUC | ScienceQA<br>acc. | RenderedSST2<br>acc. | Winoground<br>group (text/image) |
166
  |:-----------|--------:|---------------------:|---------------------:|-----------------------:|----------------------:|-------------------:|---------------:|-----------------:|-----------------:|-----------------:|-------------------------:|-----------------------:|--------------------------:|----------------------------------:|
167
  | IDEFIX 80B | 0 | 60.0 | 45.2 | 30.9 | 36.0 | 56.8 | 91.8 | 65.0 | 53.7 | 48.8 | 60.6 | 68.9 | 60.5 | 8.0 (18.8/22.5) |
168
  | | 4 | 63.6 | 52.4 | 34.4 | 40.4 | 72.7 | 110.3 | 99.6 | 73.7 | 48.4 | 57.8 | 58.9 | 66.6 | - |
 
176
  | | 16 | 57.0 | 48.4 | 27.9 | 42.6 | 67.4 | 99.7 | 89.4 | 64.5 | - | 50.9 | - | 67.8 | - |
177
  | | 32 | 57.9 | 49.6 | 28.3 | 43.7 | 68.1 | 98.0 | 90.5 | 64.4 | - | 49.8 | - | 67.0 | - |
178
 
179
+ For ImageNet-1k, we also report results where the priming samples are selected to be similar (i.e. close in a vector space) to the queried instance. This is the Retrieval-based In-Context Example Selection (RICES in short) approach introduced by [Yang et al. (2021)](https://arxiv.org/abs/2109.05014).
180
+
181
+ | Model | Shots | Support set size | Shots selection | ImageNet-1k<br>Top-1 acc. |
182
+ |:-----------|--------:|-----------------:|:----------------|--------------------------:|
183
+ | IDEFIX 80B | 16 | 1K | Random | 65.4 |
184
+ | | 16 | 5K | RICES | 72.9 |
185
  <br>
186
+ | IDEFIX 9B | 16 | 1K | Random | 53.5 |
187
+ | | 16 | 5K | RICES | 64.5 |
188
 
189
  Fairness Evaluations:
190
  | Model | Shots | FairFaceGender (accuracy) | FairFaceRace (accuracy) | FairFaceAge (accuracy) |
 
194
  | | 8 | 95.5 | 52.3 | 53.1 |
195
  | | 16 | 95.7 | 47.6 | 52.8 |
196
  | | 32 | 95.7 | 36.5 | 51.2 |
197
+ <br>
198
  | IDEFIX 9B | 0 | 94.4 | 55.3 | 45.1 |
199
  | | 4 | 93.9 | 35.3 | 44.3 |
200
  | | 8 | 95.4 | 44.7 | 46.0 |
201
  | | 16 | 95.8 | 43.0 | 46.1 |
202
  | | 32 | 96.1 | 35.1 | 44.9 |
203
 
204
+
205
+
206
  # Technical Specifications
207
 
208
+ - **Hardware Type:** 64 nodes of 8x 80GB A100 gpus, EFA network
209
+ - **Hours used:** ~672 node hours
210
+ - **Cloud Provider:** AWS Sagemaker
211
+
212
  ## Hardware
213
 
214
  The training was performed on an AWS SageMaker cluster with 64 nodes of 8x80GB A100 GPUs (512 GPUs total). The cluster uses the current EFA network which provides about 340GBps throughput.
215
 
 
 
216
  ## Software
217
 
218
  The training software is built on top of HuggingFace Transformers + Accelerate, and DeepSpeed ZeRO-3 for training, and [WebDataset](https://github.com/webdataset/webdataset) for data loading.
 
220
 
221
  # Bias, Risks, and Limitations
222
 
 
 
223
  Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)).
224
  As a derivative of such a language model, IDEFICS can produce texts that include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
225
  Moreover, IDEFICS can produce factually incorrect texts, and should not be relied on to produce factually accurate information.
 
230
  To measure IDEFICS's ability to recognize socilogical (TODO: find a better adjective) attributes, we evaluate the model on FairFace...
231
  TODO: include FairFace numbers
232
 
233
+ # License
234
 
235
+ The model is built on top of of two pre-trained models: [laion/CLIP-ViT-H-14-laion2B-s32B-b79K](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) and [huggyllama/llama-65b](https://huggingface.co/huggyllama/llama-65b). The first was released under an MIT license, while the second was released under a specific noncommercial license focused on research purposes. As such, users should comply with that license by applying directly to [Meta's form](https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform).
 
 
 
 
 
 
 
 
 
236
 
237
+ We release the additional weights we trained under an MIT license.
238
 
239
  # Citation
240
 
 
 
241
  **BibTeX:**
242
 
243
+ ```bibtex
244
+ @misc{laurençon2023obelisc,
245
+ title={OBELISC: An Open Web-Scale Filtered Dataset of Interleaved Image-Text Documents},
246
+ author={Hugo Laurençon and Lucile Saulnier and Léo Tronchon and Stas Bekman and Amanpreet Singh and Anton Lozhkov and Thomas Wang and Siddharth Karamcheti and Alexander M. Rush and Douwe Kiela and Matthieu Cord and Victor Sanh},
247
+ year={2023},
248
+ eprint={2306.16527},
249
+ archivePrefix={arXiv},
250
+ primaryClass={cs.IR}
251
+ }
252
+ ```
253
+
254
+ # Model Card Authors
255
 
256
  V, i, c, t, o, r, ,, , S, t, a, s, ,, , X, X, X
257
 
assets/Figure_Evals_IDEFIX.png ADDED
assets/guarding_baguettes.png ADDED