Alleinzellgaenger commited on
Commit
b63462e
·
1 Parent(s): 5165175

Fix hover

Browse files
Files changed (2) hide show
  1. frontend/index.html +1 -1
  2. frontend/script.js +1 -1
frontend/index.html CHANGED
@@ -117,7 +117,7 @@
117
  <section class="hover-visualization">
118
  <h2>Hover Visualization</h2>
119
  <p>
120
- Hover over the tokens to see the attention weights for the selected head. Click on a token to see the attention weights for that token across all heads.
121
  </p>
122
  <div id="tokenContainer"></div>
123
  </section>
 
117
  <section class="hover-visualization">
118
  <h2>Hover Visualization</h2>
119
  <p>
120
+ By hovering over each token, you can see which other token is important for that token. The larger the token, the more important it is for the token you are hovering over. The token with the maximal attention is colored in red.
121
  </p>
122
  <div id="tokenContainer"></div>
123
  </section>
frontend/script.js CHANGED
@@ -180,7 +180,7 @@ function highlightAttention(index, attentionData, layer_idx, head_idx) {
180
  }
181
 
182
  const weights = row.slice(0, index);
183
- const maxWeight = Math.max(...attentionData[layer_idx][head_idx]) || 1;
184
  const baseFontSize = 32;
185
  const maxIncrease = 20;
186
 
 
180
  }
181
 
182
  const weights = row.slice(0, index);
183
+ const maxWeight = Math.max(...weights) || 1;
184
  const baseFontSize = 32;
185
  const maxIncrease = 20;
186