Spaces:
Running
Running
Commit ·
b63462e
1
Parent(s): 5165175
Fix hover
Browse files- frontend/index.html +1 -1
- 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 |
-
|
| 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(...
|
| 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 |
|