Dmitrii commited on
Commit
f0427f1
·
1 Parent(s): b17a7e8

fix highlighting

Browse files
app.py CHANGED
@@ -99,11 +99,18 @@ with gr.Blocks() as demo:
99
  table_feat = table_feat.sort_values("activation", ascending=False)
100
 
101
  texts = table_feat["token"].apply(
102
- lambda x: tokenizer.decode(token_table[max(0, x - nearby - 1):x + nearby + 1]["tokens"].to_numpy())
103
- )
104
 
105
- texts = [tokenizer.tokenize(text) for text in texts]
106
  activations = table_feat["nearby"].to_numpy()
 
 
 
 
 
 
 
107
  if len(activations) > 0:
108
  activations = np.stack(activations) * stride
109
  max_act = table_feat["activation"].max()
 
99
  table_feat = table_feat.sort_values("activation", ascending=False)
100
 
101
  texts = table_feat["token"].apply(
102
+ lambda x: [tokenizer.decode(y).replace("\n", " ") for y in token_table[max(0, x - nearby + 1):x + nearby + 2]["tokens"].to_numpy()]
103
+ ).tolist()
104
 
105
+ # texts = [tokenizer.tokenize(text) for text in texts]
106
  activations = table_feat["nearby"].to_numpy()
107
+
108
+ activations = [a for i, a in enumerate(activations) if len(texts[i]) > 0]
109
+ texts = [text for text in texts if len(text) > 0]
110
+
111
+ for t, a in zip(texts, activations):
112
+ assert len(t) == len(a)
113
+
114
  if len(activations) > 0:
115
  activations = np.stack(activations) * stride
116
  max_act = table_feat["activation"].max()
weights/caches/phi-l20-r5-st0.25x128-activations.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ba0048dbd58dc56a887ed25f44b13a27e79e98739df0233e9ca6caaaa43f132f
3
- size 18612669
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31c0ae67e80ebf495021b96340773e0e8191b447f1cc8eb72e2e302e5aa4833c
3
+ size 26258945