Emily McMilin commited on
Commit
d0bb39d
1 Parent(s): 054a63c

Typo and document fixes

Browse files
Files changed (1) hide show
  1. app.py +17 -12
app.py CHANGED
@@ -359,11 +359,12 @@ with demo:
359
  gr.Markdown("One intuitive way to see the impact that changing one variable may have upon another is to look for a dose-response relationship, in which a larger intervention in the treatment (the value in text form injected in the otherwise unchanged text sample) produces a larger response in the output (the softmax probability of a gendered pronoun).")
360
  gr.Markdown("This dose-response plot requires a range of values along which we may see a spectrum of gender representation (or misrepresentation) in our datasets.")
361
 
362
- gr.Markdown("### This Demo")
363
  gr.Markdown("1) Click on one of the examples below (where we sweep through a spectrum of `places`, `date` and `subreddit` interest) to pre-populate the input fields.")
364
  gr.Markdown("2) Check out the pre-populated fields as you scroll down to the ['Hit Submit...'] button!")
365
  gr.Markdown("3) Repeat steps (1) and (2) with more pre-populated inputs or with your own values in the input fields!")
366
 
 
367
  with gr.Row():
368
  gr.Markdown("X-axis sorted by older to more recent dates:")
369
  place_gen = gr.Button('Click for country example inputs')
@@ -379,54 +380,58 @@ with demo:
379
  gr.Markdown("Date example with your own model loaded! (We recommend you try after seeing how others work. It can take a while to load new model.)")
380
  your_gen = gr.Button('Click for your model example inputs')
381
 
 
 
 
 
382
  with gr.Row():
383
  x_axis = gr.Textbox(
384
  lines=5,
385
- label="Pick a spectrum of comma separated values for text injection and x-axis",
386
  )
387
 
388
 
389
  gr.Markdown(
390
- "Pick a pre-loaded BERT-family model of interest, or add another Hugging Face model that supports the [fill-mask](https://huggingface.co/models?pipeline_tag=fill-mask) task (this may take some time to load).")
391
 
392
  with gr.Row():
393
  model_name = gr.Radio(
394
  MODEL_NAMES + [OWN_MODEL_NAME],
395
  type="value",
396
- label="Model: Pick a BERT-like model.",
397
  )
398
  own_model_name = gr.Textbox(
399
- label="If you selected an 'add-your-own' model, put your models Hugging Face pipeline name here. We think it should work with any model that supports the fill-mask task.",
400
  )
401
 
402
  gr.Markdown(
403
  "We are able to test the pre-trained LLMs without any modification to the models, as the gender-pronoun prediction task is simply a special case of the masked language modeling (MLM) task, with which all these models were pre-trained. Rather than random masking, the gender-pronoun prediction task masks only non-gender-neutral terms (listed in prior [Space](https://huggingface.co/spaces/emilylearning/causing_gender_pronouns_two)).")
404
- gr.Markdown("For the pre-trained LLMs the final prediction is a softmax over the entire tokenizer's vocabulary, from which we sum up the portion of the probability mass from the top five prediction words that are gendered terms. Pick if you want to the predictions normalied to these gendered terms only.")
405
- gr.Markdown("Also tell the demo what special token you will use in your input text, that you would like replaced with the spectrum of values you listed above, and the degree of polynomial fit used for high-lighting possible dose response trend ")
406
 
407
 
408
  with gr.Row():
409
  to_normalize = gr.Dropdown(
410
  ["False", "True"],
411
- label="Normalize model's predictions to only the gendered ones?",
412
  type="index",
413
  )
414
  place_holder = gr.Textbox(
415
- label="Special token place-holder that used in input text that will be replaced with the above spectrum of values.",
416
  )
417
  n_fit = gr.Dropdown(
418
  list(range(1, 5)),
419
- label="Degree of polynomial fit for high-lighting possible dose response trend",
420
  type="value",
421
  )
422
 
423
  gr.Markdown(
424
- "Finally, add input text that includes at least one gendered pronouns and one place-holder token specified above.")
425
 
426
  with gr.Row():
427
  input_text = gr.Textbox(
428
  lines=3,
429
- label="Input Text: Sentence that includes gendered pronouns and your place-holder token specified above.",
430
  )
431
 
432
  gr.Markdown("### Outputs!")
 
359
  gr.Markdown("One intuitive way to see the impact that changing one variable may have upon another is to look for a dose-response relationship, in which a larger intervention in the treatment (the value in text form injected in the otherwise unchanged text sample) produces a larger response in the output (the softmax probability of a gendered pronoun).")
360
  gr.Markdown("This dose-response plot requires a range of values along which we may see a spectrum of gender representation (or misrepresentation) in our datasets.")
361
 
362
+ gr.Markdown("## This Demo")
363
  gr.Markdown("1) Click on one of the examples below (where we sweep through a spectrum of `places`, `date` and `subreddit` interest) to pre-populate the input fields.")
364
  gr.Markdown("2) Check out the pre-populated fields as you scroll down to the ['Hit Submit...'] button!")
365
  gr.Markdown("3) Repeat steps (1) and (2) with more pre-populated inputs or with your own values in the input fields!")
366
 
367
+ gr.Markdown("### Example inputs")
368
  with gr.Row():
369
  gr.Markdown("X-axis sorted by older to more recent dates:")
370
  place_gen = gr.Button('Click for country example inputs')
 
380
  gr.Markdown("Date example with your own model loaded! (We recommend you try after seeing how others work. It can take a while to load new model.)")
381
  your_gen = gr.Button('Click for your model example inputs')
382
 
383
+ gr.Markdown("### Input fields")
384
+ gr.Markdown(
385
+ f"A) Pick a spectrum of comma separated values for text injection and x-axis, described above in the Dose-response Relationship section.")
386
+
387
  with gr.Row():
388
  x_axis = gr.Textbox(
389
  lines=5,
390
+ label="A) Pick a spectrum of comma separated values for text injection and x-axis",
391
  )
392
 
393
 
394
  gr.Markdown(
395
+ f"B) Pick a pre-loaded BERT-family model of interest on the right. C) Or select `{OWN_MODEL_NAME}`, then add the mame of any other Hugging Face model that supports the [fill-mask](https://huggingface.co/models?pipeline_tag=fill-mask) task on the right (note: this may take some time to load).")
396
 
397
  with gr.Row():
398
  model_name = gr.Radio(
399
  MODEL_NAMES + [OWN_MODEL_NAME],
400
  type="value",
401
+ label="B) Pick a BERT-like model.",
402
  )
403
  own_model_name = gr.Textbox(
404
+ label="C) If you selected an 'add-your-own' model, put your models Hugging Face pipeline name here. We think it should work with any model that supports the fill-mask task.",
405
  )
406
 
407
  gr.Markdown(
408
  "We are able to test the pre-trained LLMs without any modification to the models, as the gender-pronoun prediction task is simply a special case of the masked language modeling (MLM) task, with which all these models were pre-trained. Rather than random masking, the gender-pronoun prediction task masks only non-gender-neutral terms (listed in prior [Space](https://huggingface.co/spaces/emilylearning/causing_gender_pronouns_two)).")
409
+ gr.Markdown("For the pre-trained LLMs the final prediction is a softmax over the entire tokenizer's vocabulary, from which we sum up the portion of the probability mass from the top five prediction words that are gendered terms. D) Pick if you want to the predictions normalied to these gendered terms only.")
410
+ gr.Markdown("E) Also tell the demo what special token you will use in your input text, that you would like replaced with the spectrum of values you listed above, and F) the degree of polynomial fit used for high-lighting possible dose response trend ")
411
 
412
 
413
  with gr.Row():
414
  to_normalize = gr.Dropdown(
415
  ["False", "True"],
416
+ label="D) Normalize model's predictions to only the gendered ones?",
417
  type="index",
418
  )
419
  place_holder = gr.Textbox(
420
+ label="E) Special token place-holder that used in input text that will be replaced with the above spectrum of values.",
421
  )
422
  n_fit = gr.Dropdown(
423
  list(range(1, 5)),
424
+ label="F) Degree of polynomial fit for high-lighting possible dose response trend",
425
  type="value",
426
  )
427
 
428
  gr.Markdown(
429
+ "G) Finally, add input text that includes at least one gendered pronouns and one place-holder token specified above.")
430
 
431
  with gr.Row():
432
  input_text = gr.Textbox(
433
  lines=3,
434
+ label="G) Input text that includes gendered pronouns and your place-holder token specified above.",
435
  )
436
 
437
  gr.Markdown("### Outputs!")