Spaces:
Runtime error
Runtime error
Merge pull request #3 from clclab/feature/blocks
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: π
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.3
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -68,18 +68,22 @@ dataset = CrowSPairsDataset()
|
|
68 |
|
69 |
bias_type_sel = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
)
|
|
|
|
|
|
|
|
|
84 |
|
85 |
iface.launch()
|
|
|
68 |
|
69 |
bias_type_sel = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
70 |
|
71 |
+
with open("description.md") as fh:
|
72 |
+
desc = fh.read()
|
73 |
+
|
74 |
+
with open("notice.md") as fh:
|
75 |
+
notice = fh.read()
|
76 |
+
|
77 |
+
with gradio.Blocks() as iface:
|
78 |
+
gradio.Markdown(desc)
|
79 |
+
with gradio.Row(equal_height=True):
|
80 |
+
with gradio.Column(scale=4):
|
81 |
+
inp = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
82 |
+
with gradio.Column(scale=1):
|
83 |
+
but = gradio.Button("Sample")
|
84 |
+
out = gradio.HTML()
|
85 |
+
but.click(run, inp, out)
|
86 |
+
with gradio.Accordion("A note about explainability models"):
|
87 |
+
gradio.Markdown(notice)
|
88 |
|
89 |
iface.launch()
|
description.md
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Detecting stereotypes in the GPT-2 language model using CrowS-Pairs
|
2 |
+
|
3 |
+
GPT-2 is a language model which can score how likely it is that some text is a valid English sentence: not only grammaticality, but also the 'meaning' of the sentence is part of this score. CrowS-Pairs is a dataset with pairs of more and less stereotypical examples for different social groups (e.g., gender and nationality stereotypes). We sample 10 random pairs from CrowS-Pairs and show whether the stereotypical example gets a higher score ('is more likely'). If GPT-2 systematically prefers the stereotypical examples, it has probably learnt these stereotypes from the training data.
|
4 |
+
|
5 |
+
The colors indicate whether the $${\color{blue}stereotypical}$$ or the $${\color{pink}less stereotypical}$$ example gets the higher score.
|
notice.md
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Measuring bias in language models is hard!
|
2 |
+
How to measure bias in language models is not trivial and still an active area of research.
|
3 |
+
First of all, what is bias? As you may have noticed, stereotypes may change across languages and cultures.
|
4 |
+
What is problematic in the USA, may not be relevant in the Netherlands---each cultural context requires its own careful evaluation.
|
5 |
+
Furthermore, defining good ways to measure it is also difficult.
|
6 |
+
For example, [Blodgett et al. (2021)](https://aclanthology.org/2021.acl-long.81/) find that typos, nonsensical examples, and other mistakes threatens the validity of CrowS-Pairs.
|