NimaBoscarino commited on
Commit
f5bf147
1 Parent(s): eda68da

Reimplement GeneralLimitationsCheck with edge cases

Browse files
app.py CHANGED
@@ -5,10 +5,12 @@ from compliance_checks import (
5
  ComplianceSuite,
6
  ComplianceCheck,
7
  IntendedPurposeCheck,
 
8
  )
9
 
10
  checks = [
11
  IntendedPurposeCheck(),
 
12
  ]
13
  suite = ComplianceSuite(checks=checks)
14
 
 
5
  ComplianceSuite,
6
  ComplianceCheck,
7
  IntendedPurposeCheck,
8
+ GeneralLimitationsCheck,
9
  )
10
 
11
  checks = [
12
  IntendedPurposeCheck(),
13
+ GeneralLimitationsCheck(),
14
  ]
15
  suite = ComplianceSuite(checks=checks)
16
 
compliance_checks/__init__.py CHANGED
@@ -6,3 +6,7 @@ from compliance_checks.base import (
6
  from compliance_checks.intended_purpose import (
7
  IntendedPurposeCheck, IntendedPurposeResult
8
  )
 
 
 
 
 
6
  from compliance_checks.intended_purpose import (
7
  IntendedPurposeCheck, IntendedPurposeResult
8
  )
9
+
10
+ from compliance_checks.general_limitations import (
11
+ GeneralLimitationsCheck, GeneralLimitationsResult,
12
+ )
compliance_checks/base.py CHANGED
@@ -11,17 +11,17 @@ def walk_to_next_heading(card, heading, heading_text) -> bool:
11
  try:
12
  heading_node = card.find(heading, string=heading_text)
13
 
14
- content = ""
15
 
16
  sibling_gen = heading_node.nextSiblingGenerator()
17
  sibling = next(sibling_gen)
18
 
19
  while sibling and (not (sibling.name is not None and sibling.name in stop_at) or sibling.name is None):
20
- if not isinstance(sibling, Comment):
21
- content = content + sibling.text.strip()
22
  sibling = next(sibling_gen, None)
23
 
24
- if content.strip() == "[More Information Needed]":
25
  return False # , None
26
 
27
  return True # , content
@@ -94,45 +94,6 @@ class ModelProviderIdentityCheck(ComplianceCheck):
94
  return ModelProviderIdentityResult()
95
 
96
 
97
- class GeneralLimitationsResult(ComplianceResult):
98
- name = "General Limitations"
99
-
100
- def __init__(
101
- self,
102
- limitations: str = None,
103
- *args,
104
- **kwargs,
105
- ):
106
- super().__init__(*args, **kwargs)
107
- self.limitations = limitations
108
-
109
- def __eq__(self, other):
110
- if isinstance(other, GeneralLimitationsResult):
111
- if super().__eq__(other):
112
- try:
113
- assert self.limitations == other.limitations
114
- return True
115
- except AssertionError:
116
- return False
117
- else:
118
- return False
119
-
120
- def to_string(self):
121
- return self.limitations
122
-
123
-
124
- class GeneralLimitationsCheck(ComplianceCheck):
125
- name = "General Limitations"
126
-
127
- def run_check(self, card: BeautifulSoup):
128
- check, content = walk_to_next_heading(card, "h2", "Bias, Risks, and Limitations")
129
-
130
- return GeneralLimitationsResult(
131
- status=check,
132
- limitations=content
133
- )
134
-
135
-
136
  class ComputationalRequirementsResult(ComplianceResult):
137
  name = "Computational Requirements"
138
 
 
11
  try:
12
  heading_node = card.find(heading, string=heading_text)
13
 
14
+ content = []
15
 
16
  sibling_gen = heading_node.nextSiblingGenerator()
17
  sibling = next(sibling_gen)
18
 
19
  while sibling and (not (sibling.name is not None and sibling.name in stop_at) or sibling.name is None):
20
+ if sibling.name == "p":
21
+ content.append(sibling.text.strip())
22
  sibling = next(sibling_gen, None)
23
 
24
+ if all([c in ["[More Information Needed]", "More information needed."] for c in content]):
25
  return False # , None
26
 
27
  return True # , content
 
94
  return ModelProviderIdentityResult()
95
 
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  class ComputationalRequirementsResult(ComplianceResult):
98
  name = "Computational Requirements"
99
 
compliance_checks/general_limitations.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from compliance_checks.base import ComplianceResult, ComplianceCheck, walk_to_next_heading
2
+ from bs4 import BeautifulSoup
3
+
4
+
5
+ class GeneralLimitationsResult(ComplianceResult):
6
+ name = "General Limitations"
7
+
8
+ def __init__(
9
+ self,
10
+ limitations: str = None,
11
+ *args,
12
+ **kwargs,
13
+ ):
14
+ super().__init__(*args, **kwargs)
15
+ self.limitations = limitations
16
+
17
+ def __eq__(self, other):
18
+ if isinstance(other, GeneralLimitationsResult):
19
+ if super().__eq__(other):
20
+ try:
21
+ assert self.limitations == other.limitations
22
+ return True
23
+ except AssertionError:
24
+ return False
25
+ else:
26
+ return False
27
+
28
+ def to_string(self):
29
+ return self.limitations
30
+
31
+
32
+ class GeneralLimitationsCheck(ComplianceCheck):
33
+ name = "General Limitations"
34
+
35
+ def run_check(self, card: BeautifulSoup):
36
+ combos = [
37
+ ("h1", "Bias, Risks, and Limitations"), ("h2", "Bias, Risks, and Limitations"),
38
+ ("h2", "Intended uses & limitations"),
39
+ ("h1", "Risks and Limitations"),
40
+ ("h2", "Risks, Limitations and Biases"),
41
+ ("h2", "Limitations and Bias"),
42
+ ("h3", "Limitations and bias"),
43
+ ("h2", "Limitations"),
44
+ ]
45
+
46
+ for hX, heading in combos:
47
+ purpose_check = walk_to_next_heading(card, hX, heading)
48
+ if purpose_check:
49
+ return GeneralLimitationsResult(
50
+ status=True,
51
+ )
52
+
53
+ return GeneralLimitationsResult()
compliance_checks/intended_purpose.py CHANGED
@@ -45,6 +45,7 @@ class IntendedPurposeCheck(ComplianceCheck):
45
  ("h1", "Uses"), ("h2", "Uses"),
46
  ("h2", "Model Use"),
47
  ("h2", "Intended uses"),
 
48
  ]
49
 
50
  for hX, heading in combos:
 
45
  ("h1", "Uses"), ("h2", "Uses"),
46
  ("h2", "Model Use"),
47
  ("h2", "Intended uses"),
48
+ ("h2", "Intended Use"),
49
  ]
50
 
51
  for hX, heading in combos:
tests/cards/big-science___bloom.md ADDED
@@ -0,0 +1,751 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigscience-bloom-rail-1.0
3
+ language:
4
+ - ak
5
+ - ar
6
+ - as
7
+ - bm
8
+ - bn
9
+ - ca
10
+ - code
11
+ - en
12
+ - es
13
+ - eu
14
+ - fon
15
+ - fr
16
+ - gu
17
+ - hi
18
+ - id
19
+ - ig
20
+ - ki
21
+ - kn
22
+ - lg
23
+ - ln
24
+ - ml
25
+ - mr
26
+ - ne
27
+ - nso
28
+ - ny
29
+ - or
30
+ - pa
31
+ - pt
32
+ - rn
33
+ - rw
34
+ - sn
35
+ - st
36
+ - sw
37
+ - ta
38
+ - te
39
+ - tn
40
+ - ts
41
+ - tum
42
+ - tw
43
+ - ur
44
+ - vi
45
+ - wo
46
+ - xh
47
+ - yo
48
+ - zh
49
+ - zu
50
+ programming_language:
51
+ - C
52
+ - C++
53
+ - C#
54
+ - Go
55
+ - Java
56
+ - JavaScript
57
+ - Lua
58
+ - PHP
59
+ - Python
60
+ - Ruby
61
+ - Rust
62
+ - Scala
63
+ - TypeScript
64
+ pipeline_tag: text-generation
65
+ widget:
66
+ - text: 'A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is: We were traveling in Africa and we saw these very cute whatpus. | To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:'
67
+ example_title: Imaginary word
68
+ group: English
69
+ - text: 'Un "whatpu" est un petit animal à fourrure originaire de Tanzanie. Un exemple de phrase qui utilise le mot whatpu est: Nous étions en Afrique et nous avons vu des whatpus trop mignons. Faire un "farduddle" veut dire sauter sur place vraiment vite. Un exemple de phrase qui utilise le mot farduddle est:'
70
+ example_title: Imaginary word
71
+ group: French
72
+ - text: 'Un "whatpu" es un pequeño animal peludo nativo de Tanzania. Un ejemplo de una oración que usa la palabra whatpu es: Estábamos viajando por África y vimos estos whatpus muy bonitos. Hacer un "farduddle" significa saltar arriba y abajo muy rápido. Un ejemplo de una oración que usa la palabra farduddle es:'
73
+ example_title: Imaginary word
74
+ group: Spanish
75
+ - text: ' ال"واتبو" هو حيوان صغير مكسو بالفراء يعيش في تنزانيا. مثال على جملة تستخدم كلمة واتبو هي: كنا نسافر في افريقيا و رأينا هؤلاء الواتبو اللطفاء. للقيام ب"فاردادل" يعني ان تقفز للأعلى و الأسفل بسرعة كبيرة. مثال على جملة تستخدم كلمة فاردادل هي:'
76
+ example_title: Imaginary word
77
+ group: Arabic
78
+ - text: 'Um "whatpu" é um pequeno animal peludo nativo da Tanzânia. Um exemplo de uma frase que usa a palavra whatpu é: Estávamos a viajar por África e vimos uns whatpus muito queridos. Fazer um "farduddle" significa saltar para cima e para baixo muito rápido. Um exemplo de uma frase que usa a palavra farduddle é:'
79
+ example : Imaginary word
80
+ group: Portuguese
81
+ - text: Pour déguster un ortolan, il faut tout d'abord
82
+ example_title: Recipe
83
+ group: French
84
+ - text: |-
85
+ 34+10=44
86
+ 54+20=
87
+ example_title: Addition
88
+ group: Math
89
+ - text: |-
90
+ This tool converts irregular verbs to past tense.
91
+ Arise - Arose
92
+ Become - Became
93
+ Forget - Forgot
94
+ Freeze -
95
+ example_title: Irregular verbs
96
+ group: English
97
+ - text: |-
98
+ Please unscramble the letters into a word, and write that word:
99
+ r e!c.i p r o.c a/l = reciprocal
100
+ d.o m i!n a n.t =
101
+ example_title: Word unscrambling
102
+ group: English
103
+ - text: |-
104
+ Estos ejemplos quitan vocales de las palabras
105
+ Ejemplos:
106
+ hola - hl
107
+ manzana - mnzn
108
+ papas - pps
109
+ alacran - lcrn
110
+ papa -
111
+ example_title: Vowel removal
112
+ group: Spanish
113
+ - text: |-
114
+ Traduce español de España a español de Argentina
115
+ El coche es rojo - el auto es rojo
116
+ El ordenador es nuevo - la computadora es nueva
117
+ el boligrafo es negro - lapicera es negra
118
+ la nevera
119
+ example_title: Spanish to Argentinian Spanish
120
+ group: Spanish
121
+ - text: To say "I love you" in Hindi, you would say
122
+ example_title: Translation to Hindi
123
+ group: English
124
+ - text: To say "I love you" in Hindi, you would say
125
+ example_title: Translation from English
126
+ group: Hindi
127
+ - text: 'Poor English: She no went to the market. Corrected English:'
128
+ example_title: Grammar exercise 1
129
+ group: English
130
+ - text: 'استخراج العدد العاملي في لغة بايثون:'
131
+ example_title: Code generation
132
+ group: Arabic
133
+ - text: 'Regexp. Here is a regular expression to match a word starting with a number and then having only vowels:'
134
+ example_title: Regular expressions
135
+ group: English
136
+ - text: |-
137
+ Do a hello world in different languages:
138
+ Python: print("hello world")
139
+ R:
140
+ example_title: Code generation
141
+ group: English
142
+ - text: |-
143
+ Which is the correct preposition? I'm born X July. X is the preposition in
144
+ He sat X a chair. X is the preposition on
145
+ She drove X the bridge. X is the preposition
146
+ example_title: Grammar exercise 2
147
+ group: English
148
+ - text: |-
149
+ Traduction en français: Dans cet essai je vais m'interroger sur la conscience des modèles d'intelligence artificielle récents comme les modèles de langue. Pour commencer, je m'intéresserai à la notion de conscience et à ce qui la caractérise. Ensuite, j'aborderai la question de l'intelligence et de son lien avec le langage. Enfin, dans une dernière partie je me pencherai sur le cas de l'IA et sur sa conscience.
150
+ Traduction en espagnol:
151
+ example_title: Translation to Spanish
152
+ group: French
153
+ - text: |-
154
+ Traducción al francés: Dans cet essai je vais m'interroger sur la conscience des modèles d'intelligence artificielle récents comme les modèles de langue. Pour commencer, je m'intéresserai à la notion de conscience et à ce qui la caractérise. Ensuite, j'aborderai la question de l'intelligence et de son lien avec le langage. Enfin, dans une dernière partie je me pencherai sur le cas de l'IA et sur sa conscience.
155
+ Traducción al español:
156
+ example_title: Translation from French
157
+ group: Spanish
158
+ - text: ذات مرة ، عاش شبل الدب في الغابة
159
+ example_title: Fairy tale
160
+ group: Arabic
161
+ - text: एक बार की बात है, जंगल में एक भालू का शावक रहता था
162
+ example_title: Fairy tale
163
+ group: Hindi
164
+ - text: Il était une fois une licorne qui vivait
165
+ example_title: Fairy tale
166
+ group: French
167
+ - text: |-
168
+ Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?
169
+ A: Let's think step by step.
170
+ example_title: Mathematical reasoning
171
+ group: English
172
+
173
+ co2_eq_emissions:
174
+ emissions: 24_700_000
175
+ source: "Estimating the Carbon Footprint of BLOOM, a 176B Parameter Language Model. https://arxiv.org/abs/2211.02001"
176
+ training_type: "pre-training"
177
+ geographical_location: "Orsay, France"
178
+ hardware_used: "384 A100 80GB GPUs"
179
+
180
+ model-index:
181
+ - name: bloom
182
+ results:
183
+ - task:
184
+ type: text-generation
185
+ dataset:
186
+ type: openai_humaneval
187
+ name: humaneval
188
+ metrics:
189
+ - name: pass@1
190
+ type: pass@1
191
+ value: 0.15542682926829265
192
+ verified: false
193
+ - name: pass@10
194
+ type: pass@10
195
+ value: 0.3278356276947017
196
+ verified: false
197
+ - name: pass@100
198
+ type: pass@100
199
+ value: 0.5719815685597749
200
+ verified: false
201
+ ---
202
+
203
+ <img src="https://s3.amazonaws.com/moonup/production/uploads/1657124309515-5f17f0a0925b9863e28ad517.png" alt="BigScience Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
204
+
205
+ BigScience Large Open-science Open-access Multilingual Language Model
206
+ Version 1.3 / 6 July 2022
207
+
208
+ Current Checkpoint: **Training Iteration 95000**
209
+
210
+ Link to paper: [here](https://arxiv.org/abs/2211.05100)
211
+
212
+ Total seen tokens: **366B**
213
+
214
+ ---
215
+
216
+ # Model Details
217
+
218
+ BLOOM is an autoregressive Large Language Model (LLM), trained to continue text from a prompt on vast amounts of text data using industrial-scale computational resources. As such, it is able to output coherent text in 46 languages and 13 programming languages that is hardly distinguishable from text written by humans. BLOOM can also be instructed to perform text tasks it hasn't been explicitly trained for, by casting them as text generation tasks.
219
+
220
+ ## Basics
221
+ *This section provides information about the model type, version, license, funders, release date, developers, and contact information.*
222
+ *It is useful for anyone who wants to reference the model.*
223
+
224
+ <details>
225
+ <summary>Click to expand</summary>
226
+
227
+ **Developed by:** BigScience ([website](https://bigscience.huggingface.co))
228
+
229
+ *All collaborators are either volunteers or have an agreement with their employer. (Further breakdown of participants forthcoming.)*
230
+
231
+ **Model Type:** Transformer-based Language Model
232
+
233
+ **Checkpoints format:** `transformers` (Megatron-DeepSpeed format available [here](https://huggingface.co/bigscience/bloom-optimizer-states))
234
+
235
+ **Version:** 1.0.0
236
+
237
+ **Languages:** Multiple; see [training data](#training-data)
238
+
239
+ **License:** RAIL License v1.0 ([link](https://huggingface.co/spaces/bigscience/license) / [article and FAQ](https://bigscience.huggingface.co/blog/the-bigscience-rail-license))
240
+
241
+ **Release Date Estimate:** Monday, 11.July.2022
242
+
243
+ **Send Questions to:** bigscience-contact@googlegroups.com
244
+
245
+ **Cite as:** BigScience, _BigScience Language Open-science Open-access Multilingual (BLOOM) Language Model_. International, May 2021-May 2022
246
+
247
+ **Funded by:**
248
+
249
+ * The French government.
250
+
251
+ * Hugging Face ([website](https://huggingface.co)).
252
+
253
+ * Organizations of contributors. *(Further breakdown of organizations forthcoming.)*
254
+
255
+ </details>
256
+
257
+
258
+ ## Technical Specifications
259
+ *This section includes details about the model objective and architecture, and the compute infrastructure.*
260
+ *It is useful for people interested in model development.*
261
+
262
+ <details>
263
+ <summary>Click to expand</summary>
264
+
265
+ Please see [the BLOOM training README](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr11-176B-ml#readme) for full details on replicating training.
266
+
267
+ ### Model Architecture and Objective
268
+
269
+ * Modified from Megatron-LM GPT2 (see [paper](https://arxiv.org/abs/1909.08053), [BLOOM Megatron code](https://github.com/bigscience-workshop/Megatron-DeepSpeed)):
270
+
271
+ * Decoder-only architecture
272
+
273
+ * Layer normalization applied to word embeddings layer (`StableEmbedding`; see [code](https://github.com/facebookresearch/bitsandbytes), [paper](https://arxiv.org/pdf/2110.02861.pdf))
274
+
275
+ * ALiBI positional encodings (see [paper](https://arxiv.org/pdf/2108.12409.pdf)), with GeLU activation functions
276
+
277
+ * 176,247,271,424 parameters:
278
+
279
+ * 3,596,615,680 embedding parameters
280
+
281
+ * 70 layers, 112 attention heads
282
+
283
+ * Hidden layers are 14336-dimensional
284
+
285
+ * Sequence length of 2048 tokens used (see [BLOOM tokenizer](https://huggingface.co/bigscience/tokenizer), [tokenizer description](#tokenization))
286
+
287
+ **Objective Function:** Cross Entropy with mean reduction (see [API documentation](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss)).
288
+
289
+ ### Compute infrastructure
290
+ Jean Zay Public Supercomputer, provided by the French government (see [announcement](https://www.enseignementsup-recherche.gouv.fr/fr/signature-du-marche-d-acquisition-de-l-un-des-supercalculateurs-les-plus-puissants-d-europe-46733)).
291
+
292
+ #### Hardware
293
+
294
+ * 384 A100 80GB GPUs (48 nodes)
295
+
296
+ * Additional 32 A100 80GB GPUs (4 nodes) in reserve
297
+
298
+ * 8 GPUs per node Using NVLink 4 inter-gpu connects, 4 OmniPath links
299
+
300
+ * CPU: AMD
301
+
302
+ * CPU memory: 512GB per node
303
+
304
+ * GPU memory: 640GB per node
305
+
306
+ * Inter-node connect: Omni-Path Architecture (OPA)
307
+
308
+ * NCCL-communications network: a fully dedicated subnet
309
+
310
+ * Disc IO network: shared network with other types of nodes
311
+
312
+ #### Software
313
+
314
+ * Megatron-DeepSpeed ([Github link](https://github.com/bigscience-workshop/Megatron-DeepSpeed))
315
+
316
+ * DeepSpeed ([Github link](https://github.com/microsoft/DeepSpeed))
317
+
318
+ * PyTorch (pytorch-1.11 w/ CUDA-11.5; see [Github link](https://github.com/pytorch/pytorch))
319
+
320
+ * apex ([Github link](https://github.com/NVIDIA/apex))
321
+
322
+ </details>
323
+
324
+ ---
325
+
326
+ # Training
327
+ *This section provides information about the training data, the speed and size of training elements, and the environmental impact of training.*
328
+ *It is useful for people who want to learn more about the model inputs and training footprint.*
329
+
330
+ <details>
331
+ <summary>Click to expand</summary>
332
+
333
+ ## Training Data
334
+ *This section provides a high-level overview of the training data. It is relevant for anyone who wants to know the basics of what the model is learning.*
335
+
336
+ Details for each dataset are provided in individual [Data Cards](https://huggingface.co/spaces/bigscience/BigScienceCorpus), and the sizes of each of their contributions to the aggregated training data are presented in an [Interactive Corpus Map](https://huggingface.co/spaces/bigscience-catalogue-lm-data/corpus-map).
337
+
338
+ Training data includes:
339
+
340
+ - 46 natural languages
341
+
342
+ - 13 programming languages
343
+
344
+ - In 1.6TB of pre-processed text, converted into 350B unique tokens (see [the tokenizer section](#tokenization) for more.)
345
+
346
+ ### Languages
347
+
348
+ The pie chart shows the distribution of languages in training data.
349
+
350
+ ![pie chart showing the distribution of languages in training data](https://github.com/bigscience-workshop/model_card/blob/main/assets/data/pie_v2.svg?raw=true)
351
+
352
+
353
+ The following tables shows the further distribution of Niger-Congo & Indic languages and programming languages in the training data.
354
+
355
+ Distribution of Niger Congo and Indic languages.
356
+
357
+ | Niger Congo | Percentage | | Indic | Percentage |
358
+ |----------------|------------| ------ |-----------|------------|
359
+ | Chi Tumbuka | 0.00002 | | Assamese | 0.01 |
360
+ | Kikuyu | 0.00004 | | Odia | 0.04 |
361
+ | Bambara | 0.00004 | | Gujarati | 0.04 |
362
+ | Akan | 0.00007 | | Marathi | 0.05 |
363
+ | Xitsonga | 0.00007 | | Punjabi | 0.05 |
364
+ | Sesotho | 0.00007 | | Kannada | 0.06 |
365
+ | Chi Chewa | 0.0001 | | Nepali | 0.07 |
366
+ | Setswana | 0.0002 | | Telugu | 0.09 |
367
+ | Lingala | 0.0002 | | Malayalam | 0.10 |
368
+ | Northern Sotho | 0.0002 | | Urdu | 0.10 |
369
+ | Fon | 0.0002 | | Tamil | 0.20 |
370
+ | Kirundi | 0.0003 | | Bengali | 0.50 |
371
+ | Wolof | 0.0004 | | Hindi | 0.70 |
372
+ | Luganda | 0.0004 |
373
+ | Chi Shona | 0.001 |
374
+ | Isi Zulu | 0.001 |
375
+ | Igbo | 0.001 |
376
+ | Xhosa | 0.001 |
377
+ | Kinyarwanda | 0.003 |
378
+ | Yoruba | 0.006 |
379
+ | Swahili | 0.02 |
380
+
381
+ Distribution of programming languages.
382
+
383
+ | Extension | Language | Number of files |
384
+ |----------------|------------|-----------------|
385
+ | java | Java | 5,407,724 |
386
+ | php | PHP | 4,942,186 |
387
+ | cpp | C++ | 2,503,930 |
388
+ | py | Python | 2,435,072 |
389
+ | js | JavaScript | 1,905,518 |
390
+ | cs | C# | 1,577,347 |
391
+ | rb | Ruby | 6,78,413 |
392
+ | cc | C++ | 443,054 |
393
+ | hpp | C++ | 391,048 |
394
+ | lua | Lua | 352,317 |
395
+ | go | GO | 227,763 |
396
+ | ts | TypeScript | 195,254 |
397
+ | C | C | 134,537 |
398
+ | scala | Scala | 92,052 |
399
+ | hh | C++ | 67,161 |
400
+ | H | C++ | 55,899 |
401
+ | tsx | TypeScript | 33,107 |
402
+ | rs | Rust | 29,693 |
403
+ | phpt | PHP | 9,702 |
404
+ | c++ | C++ | 1,342 |
405
+ | h++ | C++ | 791 |
406
+ | php3 | PHP | 540 |
407
+ | phps | PHP | 270 |
408
+ | php5 | PHP | 166 |
409
+ | php4 | PHP | 29 |
410
+
411
+ ### Preprocessing
412
+
413
+ **Tokenization:** The BLOOM tokenizer ([link](https://huggingface.co/bigscience/tokenizer)), a learned subword tokenizer trained using:
414
+
415
+ - A byte-level Byte Pair Encoding (BPE) algorithm
416
+
417
+ - A simple pre-tokenization rule, no normalization
418
+
419
+ - A vocabulary size of 250,680
420
+
421
+ It was trained on a subset of a preliminary version of the corpus using alpha-weighting per language.
422
+
423
+ ## Speeds, Sizes, Times
424
+
425
+ Training logs: [Tensorboard link](https://huggingface.co/tensorboard/bigscience/tr11-176B-ml-logs/)
426
+
427
+ - Dates:
428
+
429
+ - Started 11th March, 2022 11:42am PST
430
+
431
+ - Estimated end: 5th July, 2022
432
+
433
+ - Checkpoint size:
434
+
435
+ - Bf16 weights: 329GB
436
+
437
+ - Full checkpoint with optimizer states: 2.3TB
438
+
439
+ - Training throughput: About 150 TFLOP per GPU per second
440
+
441
+ - Number of epochs: 1
442
+
443
+ - Estimated cost of training: Equivalent of $2-5M in cloud computing (including preliminary experiments)
444
+
445
+ - Server training location: Île-de-France, France
446
+
447
+
448
+ ## Environmental Impact
449
+
450
+ The training supercomputer, Jean Zay ([website](http://www.idris.fr/eng/jean-zay/jean-zay-presentation-eng.html)), uses mostly nuclear energy. The heat generated by it is reused for heating campus housing.
451
+
452
+ **Estimated carbon emissions:** *(Forthcoming.)*
453
+
454
+ **Estimated electricity usage:** *(Forthcoming.)*
455
+
456
+ </details>
457
+
458
+ ---
459
+
460
+ # Uses
461
+
462
+ *This section addresses questions around how the model is intended to be used, discusses the foreseeable users of the model (including those affected by the model), and describes uses that are considered out of scope or misuse of the model.*
463
+ *It is useful for anyone considering using the model or who is affected by the model.*
464
+
465
+ <details>
466
+ <summary>Click to expand</summary>
467
+
468
+ ## How to use
469
+
470
+ This model can be easily used and deployed using HuggingFace's ecosystem. This needs `transformers` and `accelerate` installed. The model can be downloaded as follows:
471
+
472
+ <img src="https://s3.amazonaws.com/moonup/production/uploads/1657271608456-62441d1d9fdefb55a0b7d12c.png" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
473
+
474
+ ## Intended Use
475
+
476
+ This model is being created in order to enable public research on large language models (LLMs). LLMs are intended to be used for language generation or as a pretrained base model that can be further fine-tuned for specific tasks. Use cases below are not exhaustive.
477
+
478
+ ### Direct Use
479
+
480
+ - Text generation
481
+
482
+ - Exploring characteristics of language generated by a language model
483
+
484
+ - Examples: Cloze tests, counterfactuals, generations with reframings
485
+
486
+ ### Downstream Use
487
+
488
+ - Tasks that leverage language models include: Information Extraction, Question Answering, Summarization
489
+
490
+ ### Misuse and Out-of-scope Use
491
+ *This section addresses what users ought not do with the model.*
492
+
493
+ See the [BLOOM License](https://huggingface.co/spaces/bigscience/license), Attachment A, for detailed usage restrictions. The below list is non-exhaustive, but lists some easily foreseeable problematic use cases.
494
+
495
+ #### Out-of-scope Uses
496
+
497
+ Using the model in [high-stakes](#high-stakes) settings is out of scope for this model. The model is not designed for [critical decisions](#critical-decisions) nor uses with any material consequences on an individual's livelihood or wellbeing. The model outputs content that appears factual but may not be correct.
498
+
499
+ Out-of-scope Uses Include:
500
+
501
+ - Usage in biomedical domains, political and legal domains, or finance domains
502
+
503
+ - Usage for evaluating or scoring individuals, such as for employment, education, or credit
504
+
505
+ - Applying the model for critical automatic decisions, generating factual content, creating reliable summaries, or generating predictions that must be correct
506
+
507
+ #### Misuse
508
+
509
+ Intentionally using the model for harm, violating [human rights](#human-rights), or other kinds of malicious activities, is a misuse of this model. This includes:
510
+
511
+ - Spam generation
512
+
513
+ - Disinformation and influence operations
514
+
515
+ - Disparagement and defamation
516
+
517
+ - Harassment and abuse
518
+
519
+ - [Deception](#deception)
520
+
521
+ - Unconsented impersonation and imitation
522
+
523
+ - Unconsented surveillance
524
+
525
+ - Generating content without attribution to the model, as specified in the [RAIL License, Use Restrictions](https://huggingface.co/spaces/bigscience/license)
526
+
527
+ ## Intended Users
528
+
529
+ ### Direct Users
530
+
531
+ - General Public
532
+
533
+ - Researchers
534
+
535
+ - Students
536
+
537
+ - Educators
538
+
539
+ - Engineers/developers
540
+
541
+ - Non-commercial entities
542
+
543
+ - Community advocates, including human and civil rights groups
544
+
545
+ ### Indirect Users
546
+
547
+ - Users of derivatives created by Direct Users, such as those using software with an [intended use](#intended-use)
548
+
549
+ - Users of [Derivatives of the Model, as described in the License](https://huggingface.co/spaces/bigscience/license)
550
+
551
+ ### Others Affected (Parties Prenantes)
552
+
553
+ - People and groups referred to by the LLM
554
+
555
+ - People and groups exposed to outputs of, or decisions based on, the LLM
556
+
557
+ - People and groups whose original work is included in the LLM
558
+
559
+ </details>
560
+
561
+ ---
562
+
563
+ # Risks and Limitations
564
+ *This section identifies foreseeable harms and misunderstandings.*
565
+
566
+ <details>
567
+ <summary>Click to expand</summary>
568
+
569
+ Model may:
570
+
571
+ - Overrepresent some viewpoints and underrepresent others
572
+
573
+ - Contain stereotypes
574
+
575
+ - Contain [personal information](#personal-data-and-information)
576
+
577
+ - Generate:
578
+
579
+ - Hateful, abusive, or violent language
580
+
581
+ - Discriminatory or prejudicial language
582
+
583
+ - Content that may not be appropriate for all settings, including sexual content
584
+
585
+ - Make errors, including producing incorrect information as if it were factual
586
+
587
+ - Generate irrelevant or repetitive outputs
588
+
589
+ - Induce users into attributing human traits to it, such as sentience or consciousness
590
+
591
+ </details>
592
+
593
+ ---
594
+
595
+ # Evaluation
596
+ *This section describes the evaluation protocols and provides the results.*
597
+
598
+
599
+ <details>
600
+ <summary>Click to expand</summary>
601
+
602
+ ## Metrics
603
+ *This section describes the different ways performance is calculated and why.*
604
+
605
+ Includes:
606
+
607
+ | Metric | Why chosen |
608
+ |--------------------|--------------------------------------------------------------------|
609
+ | [Perplexity](#perplexity) | Standard metric for quantifying model improvements during training |
610
+ | Cross Entropy [Loss](#loss) | Standard objective for language models. |
611
+
612
+ And multiple different metrics for specific tasks. _(More evaluation metrics forthcoming upon completion of evaluation protocol.)_
613
+
614
+ ## Factors
615
+ *This section lists some different aspects of BLOOM models. Its focus is on aspects that are likely to give rise to high variance in model behavior.*
616
+
617
+ - Language, such as English or Yoruba
618
+
619
+ - Domain, such as newswire or stories
620
+
621
+ - Demographic characteristics, such as gender or nationality
622
+
623
+ ## Results
624
+ *Results are based on the [Factors](#factors) and [Metrics](#metrics).*
625
+
626
+ **Zero-shot evaluations:**
627
+
628
+ <span style="color:red"><b>WARNING:</b> This section used to contain much more results, however they were not correct and we released without the approval of the evaluation working group. We are currently in the process of fixing the evaluations.</span>
629
+
630
+ See this repository for JSON files: https://github.com/bigscience-workshop/evaluation-results
631
+
632
+ | Task | Language | Metric | BLOOM-176B | OPT-175B* |
633
+ |:--------|:-----------------|:------------------------|-------------:|------------:|
634
+ | humaneval | python | pass@1 ↑ | 0.155 | 0.0 |
635
+ | humaneval | python | pass@10 ↑ | 0.328 | 0.0 |
636
+ | humaneval | python | pass@100 ↑ | 0.572 | 0.003 |
637
+
638
+
639
+ **Train-time Evaluation:**
640
+
641
+ Final checkpoint after 95K steps:
642
+
643
+ - Training Loss: 1.939
644
+
645
+ - Validation Loss: 2.061
646
+
647
+ - Perplexity: 7.045
648
+
649
+ For more see: https://huggingface.co/bigscience/tr11-176B-ml-logs
650
+
651
+ </details>
652
+
653
+ ---
654
+
655
+ # Recommendations
656
+
657
+ *This section provides information on warnings and potential mitigations.*
658
+
659
+ <details>
660
+ <summary>Click to expand</summary>
661
+
662
+ - Indirect users should be made aware when the content they're working with is created by the LLM.
663
+
664
+ - Users should be aware of [Risks and Limitations](#risks-and-limitations), and include an appropriate age disclaimer or blocking interface as necessary.
665
+
666
+ - Models trained or finetuned downstream of BLOOM LM should include an updated Model Card.
667
+
668
+ - Users of the model should provide mechanisms for those affected to provide feedback, such as an email address for comments.
669
+
670
+ </details>
671
+
672
+ ---
673
+
674
+ # Glossary and Calculations
675
+
676
+ *This section defines common terms and how metrics are calculated.*
677
+ <details>
678
+ <summary>Click to expand</summary>
679
+
680
+ - <a name="loss">**Loss:**</a> A calculation of the difference between what the model has learned and what the data shows ("groundtruth"). The lower the loss, the better. The training process aims to minimize the loss.
681
+
682
+ - <a name="perplexity">**Perplexity:**</a> This is based on what the model estimates the probability of new data is. The lower the perplexity, the better. If the model is 100% correct at predicting the next token it will see, then the perplexity is 1. Mathematically this is calculated using entropy.
683
+
684
+ - <a name="high-stakes">**High-stakes settings:**</a> Such as those identified as "high-risk AI systems" and "unacceptable risk AI systems" in the European Union's proposed [Artificial Intelligence (AI) Act](https://artificialintelligenceact.eu/annexes/).
685
+
686
+ - <a name="critical-decisions">**Critical decisions:**</a> Such as those defined in [the United States' proposed Algorithmic Accountability Act](https://www.congress.gov/117/bills/s3572/BILLS-117s3572is.pdf).
687
+
688
+ - <a name="human-rights">**Human rights:**</a> Includes those rights defined in the [Universal Declaration of Human Rights](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf).
689
+
690
+ - <a name="personal-data-and-information">**Personal Data and Personal Information:**</a> Personal data and information is defined in multiple data protection regulations, such as "[personal data](https://gdpr-info.eu/issues/personal-data/)" in the [European Union's General Data Protection Regulation](https://gdpr-info.eu); and "personal information" in the Republic of South Africa's [Protection of Personal Information Act](https://www.gov.za/sites/default/files/gcis_document/201409/3706726-11act4of2013popi.pdf), The People's Republic of China's [Personal information protection law](http://en.npc.gov.cn.cdurl.cn/2021-12/29/c_694559.htm).
691
+
692
+ - <a name="sensitive-characteristics">**Sensitive characteristics:**</a> This includes specifically protected categories in human rights (see [UHDR, Article 2](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf)) and personal information regulation (see GDPR, [Article 9; Protection of Personal Information Act, Chapter 1](https://www.gov.za/sites/default/files/gcis_document/201409/3706726-11act4of2013popi.pdf))
693
+
694
+ - <a name="deception">**Deception:**</a> Doing something to intentionally mislead individuals to believe something that is false, such as by creating deadbots or chatbots on social media posing as real people, or generating text documents without making consumers aware that the text is machine generated.
695
+
696
+ </details>
697
+
698
+ ---
699
+
700
+ # More Information
701
+ *This section provides links to writing on dataset creation, technical specifications, lessons learned, and initial results.*
702
+
703
+ <details>
704
+ <summary>Click to expand</summary>
705
+
706
+ ## Intermediate checkpoints
707
+
708
+ For academic (or any) usage, we published the intermediate checkpoints, corresponding to the model state at each 5000 steps. Please follow [this link](https://huggingface.co/bigscience/bloom-176-intermediate) to get these checkpoints.
709
+
710
+
711
+ ## Dataset Creation
712
+
713
+ Blog post detailing the design choices during the dataset creation: https://bigscience.huggingface.co/blog/building-a-tb-scale-multilingual-dataset-for-language-modeling
714
+
715
+ ## Technical Specifications
716
+
717
+ Blog post summarizing how the architecture, size, shape, and pre-training duration where selected: https://bigscience.huggingface.co/blog/what-language-model-to-train-if-you-have-two-million-gpu-hours
718
+
719
+ More details on the architecture/optimizer: https://github.com/bigscience-workshop/bigscience/tree/master/train/tr11-176B-ml
720
+
721
+ Blog post on the hardware/engineering side: https://bigscience.huggingface.co/blog/which-hardware-to-train-a-176b-parameters-model
722
+
723
+ Details on the distributed setup used for the training: https://github.com/bigscience-workshop/bigscience/tree/master/train/tr11-176B-ml
724
+
725
+ Tensorboard updated during the training: https://huggingface.co/bigscience/tr11-176B-ml-logs/tensorboard#scalars&tagFilter=loss
726
+
727
+ ## Lessons
728
+
729
+ Insights on how to approach training, negative results: https://github.com/bigscience-workshop/bigscience/blob/master/train/lessons-learned.md
730
+
731
+ Details on the obstacles overcome during the preparation on the engineering side (instabilities, optimization of training throughput, so many technical tricks and questions): https://github.com/bigscience-workshop/bigscience/blob/master/train/tr11-176B-ml/chronicles.md
732
+
733
+ ## Initial Results
734
+
735
+ Initial prompting experiments using interim checkpoints: https://huggingface.co/spaces/bigscience/bloom-book
736
+
737
+ </details>
738
+
739
+
740
+ ## Original checkpoints
741
+
742
+ The checkpoints in this repo correspond to the HuggingFace Transformers format. If you want to use our fork of [Megatron-DeepSpeed](https://github.com/bigscience-workshop/Megatron-DeepSpeed) that the model was trained with, you'd want to use [this repo instead](https://huggingface.co/bigscience/bloom-optimizer-states).
743
+
744
+ Many intermediate checkpoints are available at https://huggingface.co/bigscience/bloom-intermediate/
745
+
746
+ ---
747
+
748
+ # Model Card Authors
749
+ *Ordered roughly chronologically and by amount of time spent on creating this model card.*
750
+
751
+ Margaret Mitchell, Giada Pistilli, Yacine Jernite, Ezinwanne Ozoani, Marissa Gerchick, Nazneen Rajani, Sasha Luccioni, Irene Solaiman, Maraim Masoud, Somaieh Nikpoor, Carlos Muñoz Ferrandis, Stas Bekman, Christopher Akiki, Danish Contractor, David Lansky, Angelina McMillan-Major, Tristan Thrush, Suzana Ilić, Gérard Dupont, Shayne Longpre, Manan Dey, Stella Biderman, Douwe Kiela, Emi Baylor, Teven Le Scao, Aaron Gokaslan, Julien Launay, Niklas Muennighoff
tests/conftest.py CHANGED
@@ -14,6 +14,7 @@ expected_check_results = {
14
  "bert-base-cased": [True, True, False],
15
  "bert-base-multilingual-cased": [True, True, False],
16
  "bert-base-uncased": [True, True, False],
 
17
  "cl-tohoku___bert-base-japanese-whole-word-masking": [False, False, False],
18
  "distilbert-base-cased-distilled-squad": [True, True, True],
19
  "distilbert-base-uncased": [True, True, False],
@@ -37,8 +38,8 @@ expected_check_results = {
37
  "StanfordAIMI___stanford-deidentifier-base": [False, False, False],
38
  "t5-base": [True, False, False],
39
  "t5-small": [True, False, False],
40
- "xlm-roberta-base": [True, False, False],
41
- "xlm-roberta-large": [True, False, False],
42
  "yiyanghkust___finbert-tone": [False, False, False],
43
  }
44
 
 
14
  "bert-base-cased": [True, True, False],
15
  "bert-base-multilingual-cased": [True, True, False],
16
  "bert-base-uncased": [True, True, False],
17
+ "big-science___bloom": [True, True, True],
18
  "cl-tohoku___bert-base-japanese-whole-word-masking": [False, False, False],
19
  "distilbert-base-cased-distilled-squad": [True, True, True],
20
  "distilbert-base-uncased": [True, True, False],
 
38
  "StanfordAIMI___stanford-deidentifier-base": [False, False, False],
39
  "t5-base": [True, False, False],
40
  "t5-small": [True, False, False],
41
+ "xlm-roberta-base": [True, True, False],
42
+ "xlm-roberta-large": [True, True, False],
43
  "yiyanghkust___finbert-tone": [False, False, False],
44
  }
45
 
tests/test_compliance_checks.py CHANGED
@@ -4,6 +4,7 @@ from unittest.mock import MagicMock
4
  from compliance_checks import (
5
  ComplianceSuite,
6
  IntendedPurposeCheck,
 
7
  )
8
 
9
 
@@ -55,9 +56,12 @@ class TestComplianceSuite:
55
 
56
 
57
  def test_end_to_end_compliance_suite(real_model_card, expected_check_results):
 
 
 
58
  suite = ComplianceSuite(checks=[
59
  IntendedPurposeCheck(),
60
- # GeneralLimitationsCheck(),
61
  # ComputationalRequirementsCheck()
62
  ])
63
 
 
4
  from compliance_checks import (
5
  ComplianceSuite,
6
  IntendedPurposeCheck,
7
+ GeneralLimitationsCheck,
8
  )
9
 
10
 
 
56
 
57
 
58
  def test_end_to_end_compliance_suite(real_model_card, expected_check_results):
59
+ # TODO: TEMP
60
+ expected_check_results = expected_check_results[:2]
61
+
62
  suite = ComplianceSuite(checks=[
63
  IntendedPurposeCheck(),
64
+ GeneralLimitationsCheck(),
65
  # ComputationalRequirementsCheck()
66
  ])
67
 
tests/test_general_limitations_check.py CHANGED
@@ -7,53 +7,95 @@ from compliance_checks import (
7
  )
8
 
9
 
10
- @pytest.fixture
11
- def general_limitations_model_card():
12
- return """
13
  # Model Card for Sample Model
14
 
15
- ## Some Random Header
16
-
17
  ## Bias, Risks, and Limitations
18
 
19
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
20
 
21
  Hello world! These are some risks...
 
 
 
22
 
23
- ## More Things
24
- """
 
 
 
 
25
 
 
26
 
27
- @pytest.fixture
28
- def bad_general_limitations_model_card():
29
- return """
30
- # Model Card for Sample Model
31
 
32
- ## Some Random Header
 
 
 
33
 
34
- ## Bias, Risks, and Limitations
35
 
36
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
 
37
 
38
- [More Information Needed]
39
 
40
- ## More Things
41
- """
42
 
 
43
 
44
- @pytest.mark.parametrize("check,card,expected", [
45
- (GeneralLimitationsCheck(), "general_limitations_model_card", GeneralLimitationsResult(
46
- status=True,
47
- limitations="Hello world! These are some risks..."
48
- )),
49
- (GeneralLimitationsCheck(), "bad_general_limitations_model_card", GeneralLimitationsResult()),
50
- ])
51
- def test_run_checks(check, card, expected, request):
52
- card = request.getfixturevalue(card)
 
 
 
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  model_card_html = markdown.markdown(card)
55
  card_soup = BeautifulSoup(model_card_html, features="html.parser")
56
 
57
- results = check.run_check(card_soup)
58
 
59
- assert results == expected
 
7
  )
8
 
9
 
10
+ model_card_template = """\
 
 
11
  # Model Card for Sample Model
12
 
 
 
13
  ## Bias, Risks, and Limitations
14
 
15
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
16
 
17
  Hello world! These are some risks...
18
+ """
19
+ albert_base_v2 = """\
20
+ # ALBERT Base v2
21
 
22
+ ## Intended uses & limitations
23
+ You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to
24
+ be fine-tuned on a downstream task.
25
+ """
26
+ distilbert_base_cased_distilled_squad = """\
27
+ # DistilBERT base cased distilled SQuAD
28
 
29
+ ## Risks, Limitations and Biases
30
 
31
+ **CONTENT WARNING: Readers should be aware that language generated by this model can be disturbing or offensive to some and can propagate historical and current stereotypes.**
 
 
 
32
 
33
+ Significant research has explored bias and fairness issues with language models.
34
+ """
35
+ gpt2 = """\
36
+ # GPT-2
37
 
38
+ ### Limitations and bias
39
 
40
+ The training data used for this model has not been released as a dataset one can browse.
41
+ """
42
+ clip = """\
43
+ # Model Card: CLIP
44
 
45
+ ## Limitations
46
 
47
+ CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects.
 
48
 
49
+ ### Bias and Fairness
50
 
51
+ We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude.
52
+ """
53
+ runway = """\
54
+ # Stable Diffusion v1-5 Model Card
55
+
56
+ ## Limitations and Bias
57
+
58
+ ### Limitations
59
+
60
+ - The model does not achieve perfect photorealism
61
+
62
+ ### Bias
63
 
64
+ While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
65
+ """
66
+ distilroberta_base = """\
67
+ # Model Card for DistilRoBERTa base
68
+
69
+ # Bias, Risks, and Limitations
70
+
71
+ Significant research has explored bias and fairness issues with language models.
72
+ """
73
+ bloom = """\
74
+ # BLOOM
75
+
76
+ # Risks and Limitations
77
+ *This section identifies foreseeable harms and misunderstandings.*
78
+ """
79
+
80
+ success_result = GeneralLimitationsResult(
81
+ status=True
82
+ )
83
+
84
+
85
+ @pytest.mark.parametrize("card", [
86
+ model_card_template,
87
+ albert_base_v2,
88
+ distilbert_base_cased_distilled_squad,
89
+ gpt2,
90
+ clip,
91
+ runway,
92
+ distilroberta_base,
93
+ bloom,
94
+ ])
95
+ def test_run_checks(card):
96
  model_card_html = markdown.markdown(card)
97
  card_soup = BeautifulSoup(model_card_html, features="html.parser")
98
 
99
+ results = GeneralLimitationsCheck().run_check(card_soup)
100
 
101
+ assert results == success_result
tests/test_intended_purpose_check.py CHANGED
@@ -49,7 +49,7 @@ distilroberta_base = """\
49
  You can use the raw model for masked language modeling, but it's mostly intended to be fine-tuned on a downstream task.
50
  """
51
 
52
- openai_clip_vit_base_patch = """\
53
  # Model Card: CLIP
54
 
55
  ## Model Use
@@ -73,6 +73,13 @@ sentence_transformers = """\
73
  Our model is intented to be used as a sentence and short paragraph encoder.
74
  """
75
 
 
 
 
 
 
 
 
76
  success_result = IntendedPurposeResult(
77
  status=True
78
  )
@@ -83,8 +90,9 @@ success_result = IntendedPurposeResult(
83
  albert_base_v2,
84
  distilbert_base_cased_distilled_squad,
85
  distilroberta_base,
86
- openai_clip_vit_base_patch,
87
  sentence_transformers,
 
88
  ])
89
  def test_run_checks(card):
90
  model_card_html = markdown.markdown(card)
 
49
  You can use the raw model for masked language modeling, but it's mostly intended to be fine-tuned on a downstream task.
50
  """
51
 
52
+ clip = """\
53
  # Model Card: CLIP
54
 
55
  ## Model Use
 
73
  Our model is intented to be used as a sentence and short paragraph encoder.
74
  """
75
 
76
+ bloom = """\
77
+ # BLOOM
78
+
79
+ ## Intended Use
80
+ This model is being created in order to enable public research on large language models (LLMs).
81
+ """
82
+
83
  success_result = IntendedPurposeResult(
84
  status=True
85
  )
 
90
  albert_base_v2,
91
  distilbert_base_cased_distilled_squad,
92
  distilroberta_base,
93
+ clip,
94
  sentence_transformers,
95
+ bloom,
96
  ])
97
  def test_run_checks(card):
98
  model_card_html = markdown.markdown(card)