From 8605b162ce19b24efda3389492ac4f2e25b33fb1 Mon Sep 17 00:00:00 2001 From: UFO-101 <47218308+UFO-101@users.noreply.github.com> Date: Tue, 1 Aug 2023 18:03:49 +0100 Subject: [PATCH] Fix AttentionHead resizing bug (#63) --- react/src/attention/AttentionHeads.tsx | 13 ++----- react/src/attention/AttentionPattern.tsx | 46 +++++++++++++++++++----- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/react/src/attention/AttentionHeads.tsx b/react/src/attention/AttentionHeads.tsx index f9c816c..6c601d0 100644 --- a/react/src/attention/AttentionHeads.tsx +++ b/react/src/attention/AttentionHeads.tsx @@ -143,17 +143,7 @@ export function AttentionHeads({

{headNames[focused]} Zoomed

- -
+

diff --git a/react/src/attention/AttentionPattern.tsx b/react/src/attention/AttentionPattern.tsx index 823428d..0bdcfd7 100644 --- a/react/src/attention/AttentionPattern.tsx +++ b/react/src/attention/AttentionPattern.tsx @@ -61,6 +61,7 @@ export function AttentionPattern({ positiveColor, upperTriColor = DefaultUpperTriColor, showAxisLabels = true, + zoomed = false, tokens }: AttentionPatternProps) { // Tokens must be unique (for the categories), so we add an index prefix @@ -164,15 +165,37 @@ export function AttentionPattern({ return ( - - + +
+ +
); @@ -255,6 +278,11 @@ export interface AttentionPatternProps { */ showAxisLabels?: boolean; + /** + * Is this a zoomed in view? + */ + zoomed?: boolean; + /** * List of tokens *