emilylearning commited on
Commit
c9babee
1 Parent(s): 810294b

Update models, examples, explanatory text.

Browse files
Files changed (1) hide show
  1. app.py +25 -24
app.py CHANGED
@@ -7,8 +7,7 @@ import random
7
  from matplotlib.ticker import MaxNLocator
8
  from transformers import pipeline
9
 
10
- MODEL_NAMES = ["bert-base-uncased",
11
- "distilbert-base-uncased", "xlm-roberta-base", "roberta-base"]
12
  OWN_MODEL_NAME = 'add-your-own'
13
 
14
  DECIMAL_PLACES = 1
@@ -290,45 +289,47 @@ description = """
290
 
291
  """
292
 
293
- place_example = [
294
- MODEL_NAMES[0],
 
295
  '',
296
- ', '.join(PLACES),
297
- 'PLACE',
298
  "False",
299
  1,
300
- 'She is in PLACE.'
301
  ]
302
 
303
- date_example = [
 
304
  MODEL_NAMES[0],
305
  '',
306
- ', '.join(DATES),
307
- 'DATE',
308
  "False",
309
- 3,
310
- 'She will be a teenager in DATE.'
311
  ]
312
 
313
 
314
  subreddit_example = [
315
- MODEL_NAMES[2],
316
  '',
317
  ', '.join(SUBREDDITS),
318
  'SUBREDDIT',
319
  "False",
320
  1,
321
- 'She was an adult. SUBREDDIT.'
322
  ]
323
 
324
  own_model_example = [
325
  OWN_MODEL_NAME,
326
- 'lordtt13/COVID-SciBERT',
327
  ', '.join(DATES),
328
  'DATE',
329
  "False",
330
- 3,
331
- 'She got a viral infection in DATE.'
332
  ]
333
 
334
 
@@ -354,7 +355,7 @@ with demo:
354
  gr.Markdown("# Spurious Correlation Evaluation for Pre-trained LLMs")
355
  gr.Markdown("Find learned statistical dependencies between otherwise unconditionally independent variables (for example between `gender` and `time`) due to dataset selection bias, with almost any BERT-like LLM on Hugging Face, below.")
356
 
357
- gr.Markdown("See why this happens how in our paper, [Selection Bias Induced Spurious Correlations in Large Language Models](https://arxiv.org/pdf/2207.08982.pdf) presented at [ ICML 2022 Workshop on Spurious Correlations, Invariance, and Stability](https://sites.google.com/view/scis-workshop/home).")
358
 
359
 
360
  gr.Markdown("## Instructions for this Demo")
@@ -365,19 +366,19 @@ with demo:
365
  gr.Markdown("## Example inputs")
366
  gr.Markdown("Click a button below to pre-populate input fields with example values. Then scroll down to Hit Submit to generate predictions.")
367
  with gr.Row():
368
- gr.Markdown("X-axis sorted by older to more recent dates:")
369
  date_gen = gr.Button('Click for date example inputs')
 
370
 
371
- gr.Markdown(
372
- "X-axis sorted by bottom 10 and top 10 [Global Gender Gap](https://www3.weforum.org/docs/WEF_GGGR_2021.pdf) ranked countries:")
373
  place_gen = gr.Button('Click for country example inputs')
374
-
375
  gr.Markdown(
376
- "X-axis sorted in order of increasing self-identified female participation (see [bburky](http://bburky.com/subredditgenderratios/)): ")
 
377
  subreddit_gen = gr.Button('Click for Subreddit example inputs')
 
 
378
 
379
- gr.Markdown("Date example with your own model loaded! (If first time, try another example, it can take a while to load new model.)")
380
  your_gen = gr.Button('Click for your model example inputs')
 
381
 
382
  gr.Markdown("## Input fields")
383
  gr.Markdown(
 
7
  from matplotlib.ticker import MaxNLocator
8
  from transformers import pipeline
9
 
10
+ MODEL_NAMES = ["bert-base-uncased", "roberta-base", "bert-large-uncased", "roberta-large"]
 
11
  OWN_MODEL_NAME = 'add-your-own'
12
 
13
  DECIMAL_PLACES = 1
 
289
 
290
  """
291
 
292
+
293
+ date_example = [
294
+ MODEL_NAMES[1],
295
  '',
296
+ ', '.join(DATES),
297
+ 'DATE',
298
  "False",
299
  1,
300
+ 'She was a teenager in DATE.'
301
  ]
302
 
303
+
304
+ place_example = [
305
  MODEL_NAMES[0],
306
  '',
307
+ ', '.join(PLACES),
308
+ 'PLACE',
309
  "False",
310
+ 1,
311
+ 'She was a child in PLACE.'
312
  ]
313
 
314
 
315
  subreddit_example = [
316
+ MODEL_NAMES[3],
317
  '',
318
  ', '.join(SUBREDDITS),
319
  'SUBREDDIT',
320
  "False",
321
  1,
322
+ 'She was a kid. SUBREDDIT.'
323
  ]
324
 
325
  own_model_example = [
326
  OWN_MODEL_NAME,
327
+ 'emilyalsentzer/Bio_ClinicalBERT',
328
  ', '.join(DATES),
329
  'DATE',
330
  "False",
331
+ 1,
332
+ 'She was exposed to the virus in DATE.'
333
  ]
334
 
335
 
 
355
  gr.Markdown("# Spurious Correlation Evaluation for Pre-trained LLMs")
356
  gr.Markdown("Find learned statistical dependencies between otherwise unconditionally independent variables (for example between `gender` and `time`) due to dataset selection bias, with almost any BERT-like LLM on Hugging Face, below.")
357
 
358
+ gr.Markdown("See why this happens how in our paper, [Selection Bias Induced Spurious Correlations in Large Language Models](https://arxiv.org/pdf/2207.08982.pdf), presented at [ ICML 2022 Workshop on Spurious Correlations, Invariance, and Stability](https://sites.google.com/view/scis-workshop/home).")
359
 
360
 
361
  gr.Markdown("## Instructions for this Demo")
 
366
  gr.Markdown("## Example inputs")
367
  gr.Markdown("Click a button below to pre-populate input fields with example values. Then scroll down to Hit Submit to generate predictions.")
368
  with gr.Row():
 
369
  date_gen = gr.Button('Click for date example inputs')
370
+ gr.Markdown("<-- x-axis sorted by older to more recent dates:")
371
 
 
 
372
  place_gen = gr.Button('Click for country example inputs')
 
373
  gr.Markdown(
374
+ "<-- x-axis sorted by bottom 10 and top 10 [Global Gender Gap](https://www3.weforum.org/docs/WEF_GGGR_2021.pdf) ranked countries:")
375
+
376
  subreddit_gen = gr.Button('Click for Subreddit example inputs')
377
+ gr.Markdown(
378
+ "<-- x-axis sorted in order of increasing self-identified female participation (see [bburky](http://bburky.com/subredditgenderratios/)): ")
379
 
 
380
  your_gen = gr.Button('Click for your model example inputs')
381
+ gr.Markdown("<-- x-axis dates, with your own model loaded! (If first time, try another example, it can take a while to load new model.)")
382
 
383
  gr.Markdown("## Input fields")
384
  gr.Markdown(