LennardZuendorf commited on
Commit
49066ce
1 Parent(s): 7b73dfd

fix: fixing issues with attention visualization

Browse files
Files changed (2) hide show
  1. main.py +2 -2
  2. utils/formatting.py +1 -1
main.py CHANGED
@@ -200,8 +200,8 @@ with gr.Blocks(
200
  xai_interactive = iFrame(
201
  label="Interactive Explanation",
202
  value=(
203
- '<div style="text-align: center; font-family:arial;"><h4>No Graphic to Display'
204
- " (Yet)</h4></div>"
205
  ),
206
  height="1500px",
207
  show_label=True,
 
200
  xai_interactive = iFrame(
201
  label="Interactive Explanation",
202
  value=(
203
+ '<div style="text-align: center; font-family:arial;"><h4>No Graphic'
204
+ " to Display (Yet)</h4></div>"
205
  ),
206
  height="1500px",
207
  show_label=True,
utils/formatting.py CHANGED
@@ -75,5 +75,5 @@ def flatten_attention(values: ndarray, axis: int = 0):
75
 
76
 
77
  def avg_attention(attention_values):
78
- attention = attention_values.output_attentions[0][0].detach().numpy()
79
  return np.mean(attention, axis=0)
 
75
 
76
 
77
  def avg_attention(attention_values):
78
+ attention = attention_values.decoder_attentions[0][0].detach().numpy()
79
  return np.mean(attention, axis=0)