Martijn van Beers commited on
Commit
cd3f110
1 Parent(s): 4b018a1

Move description to external file

Browse files
Files changed (2) hide show
  1. app.py +5 -16
  2. description.md +12 -0
app.py CHANGED
@@ -280,22 +280,10 @@ lig = gradio.Interface(
280
  outputs="html",
281
  )
282
 
283
- iface = gradio.Parallel(hila, lig,
284
- title="Attention Rollout -- RoBERTa",
285
- description="""
286
- In this demo, we use the RoBERTa language model (optimized for masked language modelling and finetuned for sentiment analysis).
287
- The model predicts for a given sentences whether it expresses a positive, negative or neutral sentiment.
288
- But how does it arrive at its classification? This is, surprisingly perhaps, very difficult to determine.
289
- A range of so-called "attribution methods" have been developed that attempt to determine the importance of the words in the input for the final prediction;
290
- they provide a very limited form of "explanation" -- and often disagree -- but sometimes provide good initial hypotheses nevertheless that can be further explored with other methods.
291
-
292
- Abnar & Zuidema (2020) proposed a method for Transformers called "Attention Rollout", which was further refined by Chefer et al. (2021) into Gradient-weighted Rollout.
293
- Here we compare it to another popular method called Integrated Gradient.
294
-
295
- * Gradient-weighted attention rollout, as defined by [Hila Chefer](https://github.com/hila-chefer)
296
- [(Transformer-MM_explainability)](https://github.com/hila-chefer/Transformer-MM-Explainability/), with rollout recursion upto selected layer
297
- * Layer IG, as implemented in [Captum](https://captum.ai/)(LayerIntegratedGradients), based on gradient w.r.t. selected layer.
298
- """,
299
  examples=[
300
  [
301
  "This movie was the best movie I have ever seen! some scenes were ridiculous, but acting was great",
@@ -323,4 +311,5 @@ Here we compare it to another popular method called Integrated Gradient.
323
  ]
324
  ],
325
  )
 
326
  iface.launch()
 
280
  outputs="html",
281
  )
282
 
283
+ with open("description.md", "r") as fh:
284
+ description = fh.read()
285
+
286
+ iface = gradio.Parallel(hila, lig, title="RoBERTa Explainability", description=description,
 
 
 
 
 
 
 
 
 
 
 
 
287
  examples=[
288
  [
289
  "This movie was the best movie I have ever seen! some scenes were ridiculous, but acting was great",
 
311
  ]
312
  ],
313
  )
314
+
315
  iface.launch()
description.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ In this demo, we use the RoBERTa language model (optimized for masked language modelling and finetuned for sentiment analysis).
2
+ The model predicts for a given sentences whether it expresses a positive, negative or neutral sentiment.
3
+ But how does it arrive at its classification? This is, surprisingly perhaps, very difficult to determine.
4
+ A range of so-called "attribution methods" have been developed that attempt to determine the importance of the words in the input for the final prediction;
5
+ they provide a very limited form of "explanation" -- and often disagree -- but sometimes provide good initial hypotheses nevertheless that can be further explored with other methods.
6
+
7
+ Abnar & Zuidema (2020) proposed a method for Transformers called "Attention Rollout", which was further refined by Chefer et al. (2021) into Gradient-weighted Rollout.
8
+ Here we compare it to another popular method called Integrated Gradient.
9
+
10
+ * Gradient-weighted attention rollout, as defined by [Hila Chefer](https://github.com/hila-chefer)
11
+ [(Transformer-MM_explainability)](https://github.com/hila-chefer/Transformer-MM-Explainability/), with rollout recursion upto selected layer
12
+ * Layer IG, as implemented in [Captum](https://captum.ai/)(LayerIntegratedGradients), based on gradient w.r.t. selected layer.