Spaces:
Runtime error
Runtime error
Alexander Seifert
commited on
Commit
Β·
2918df9
1
Parent(s):
d19773e
move files
Browse files- README.md +1 -1
- data.py β src/data.py +0 -0
- load.py β src/load.py +0 -0
- main.py β src/main.py +0 -0
- model.py β src/model.py +0 -0
- {subpages β src/subpages}/__init__.py +0 -0
- {subpages β src/subpages}/attention.py +2 -8
- {subpages β src/subpages}/debug.py +0 -0
- {subpages β src/subpages}/emoji-en-US.json +0 -0
- {subpages β src/subpages}/faiss.py +0 -0
- {subpages β src/subpages}/find_duplicates.py +0 -0
- {subpages β src/subpages}/hidden_states.py +2 -2
- {subpages β src/subpages}/home.py +2 -2
- {subpages β src/subpages}/inspect.py +0 -0
- {subpages β src/subpages}/losses.py +0 -0
- {subpages β src/subpages}/lossy_samples.py +0 -0
- {subpages β src/subpages}/metrics.py +0 -0
- {subpages β src/subpages}/misclassified.py +0 -0
- {subpages β src/subpages}/page.py +0 -0
- {subpages β src/subpages}/probing.py +0 -0
- {subpages β src/subpages}/random_samples.py +0 -0
- {subpages β src/subpages}/raw_data.py +0 -0
- utils.py β src/utils.py +4 -0
README.md
CHANGED
|
@@ -6,7 +6,7 @@ colorTo: indigo
|
|
| 6 |
python_version: 3.9
|
| 7 |
sdk: streamlit
|
| 8 |
sdk_version: 1.10.0
|
| 9 |
-
app_file: main.py
|
| 10 |
pinned: true
|
| 11 |
---
|
| 12 |
|
|
|
|
| 6 |
python_version: 3.9
|
| 7 |
sdk: streamlit
|
| 8 |
sdk_version: 1.10.0
|
| 9 |
+
app_file: src/main.py
|
| 10 |
pinned: true
|
| 11 |
---
|
| 12 |
|
data.py β src/data.py
RENAMED
|
File without changes
|
load.py β src/load.py
RENAMED
|
File without changes
|
main.py β src/main.py
RENAMED
|
File without changes
|
model.py β src/model.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/__init__.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/attention.py
RENAMED
|
@@ -70,8 +70,7 @@ SETUP_HTML = """
|
|
| 70 |
JS_TEMPLATE = """requirejs(['basic', 'ecco'], function(basic, ecco){{
|
| 71 |
const viz_id = basic.init()
|
| 72 |
|
| 73 |
-
ecco.interactiveTokensAndFactorSparklines(viz_id, {},
|
| 74 |
-
{{
|
| 75 |
'hltrCFG': {{'tokenization_config': {{'token_prefix': '', 'partial_token_prefix': '##'}}
|
| 76 |
}}
|
| 77 |
}})
|
|
@@ -160,12 +159,7 @@ class AttentionPage(Page):
|
|
| 160 |
data = nmf.explore(returnData=True)
|
| 161 |
JS_TEMPLATE = f"""<script>requirejs(['basic', 'ecco'], function(basic, ecco){{
|
| 162 |
const viz_id = basic.init()
|
| 163 |
-
|
| 164 |
-
ecco.interactiveTokensAndFactorSparklines(viz_id, {data},
|
| 165 |
-
{{
|
| 166 |
-
'hltrCFG': {{'tokenization_config': {{'token_prefix': '', 'partial_token_prefix': '##'}}
|
| 167 |
-
}}
|
| 168 |
-
}})
|
| 169 |
}}, function (err) {{
|
| 170 |
console.log(err);
|
| 171 |
}})</script>"""
|
|
|
|
| 70 |
JS_TEMPLATE = """requirejs(['basic', 'ecco'], function(basic, ecco){{
|
| 71 |
const viz_id = basic.init()
|
| 72 |
|
| 73 |
+
ecco.interactiveTokensAndFactorSparklines(viz_id, {}, {{
|
|
|
|
| 74 |
'hltrCFG': {{'tokenization_config': {{'token_prefix': '', 'partial_token_prefix': '##'}}
|
| 75 |
}}
|
| 76 |
}})
|
|
|
|
| 159 |
data = nmf.explore(returnData=True)
|
| 160 |
JS_TEMPLATE = f"""<script>requirejs(['basic', 'ecco'], function(basic, ecco){{
|
| 161 |
const viz_id = basic.init()
|
| 162 |
+
ecco.interactiveTokensAndFactorSparklines(viz_id, {data}, {{ 'hltrCFG': {{'tokenization_config': {{'token_prefix': '', 'partial_token_prefix': '##'}} }} }})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
}}, function (err) {{
|
| 164 |
console.log(err);
|
| 165 |
}})</script>"""
|
{subpages β src/subpages}/debug.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/emoji-en-US.json
RENAMED
|
File without changes
|
{subpages β src/subpages}/faiss.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/find_duplicates.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/hidden_states.py
RENAMED
|
@@ -135,7 +135,7 @@ class HiddenStatesPage(Page):
|
|
| 135 |
x="x",
|
| 136 |
y="y",
|
| 137 |
color="labels",
|
| 138 |
-
hover_data=["sent0", "sent1", "sent2", "sent3", "sent4"],
|
| 139 |
hover_name="tokens",
|
| 140 |
title="Colored by label",
|
| 141 |
)
|
|
@@ -147,7 +147,7 @@ class HiddenStatesPage(Page):
|
|
| 147 |
x="x",
|
| 148 |
y="y",
|
| 149 |
color="preds",
|
| 150 |
-
hover_data=["sent0", "sent1", "sent2", "sent3", "sent4"],
|
| 151 |
hover_name="tokens",
|
| 152 |
title="Colored by prediction",
|
| 153 |
)
|
|
|
|
| 135 |
x="x",
|
| 136 |
y="y",
|
| 137 |
color="labels",
|
| 138 |
+
hover_data=["ids", "preds", "sent0", "sent1", "sent2", "sent3", "sent4"],
|
| 139 |
hover_name="tokens",
|
| 140 |
title="Colored by label",
|
| 141 |
)
|
|
|
|
| 147 |
x="x",
|
| 148 |
y="y",
|
| 149 |
color="preds",
|
| 150 |
+
hover_data=["ids", "labels", "sent0", "sent1", "sent2", "sent3", "sent4"],
|
| 151 |
hover_name="tokens",
|
| 152 |
title="Colored by prediction",
|
| 153 |
)
|
{subpages β src/subpages}/home.py
RENAMED
|
@@ -6,7 +6,7 @@ import streamlit as st
|
|
| 6 |
|
| 7 |
from data import get_data
|
| 8 |
from subpages.page import Context, Page
|
| 9 |
-
from utils import classmap, color_map_color
|
| 10 |
|
| 11 |
_SENTENCE_ENCODER_MODEL = (
|
| 12 |
"sentence-transformers/all-MiniLM-L6-v2",
|
|
@@ -138,7 +138,7 @@ class HomePage(Page):
|
|
| 138 |
with col2b:
|
| 139 |
st.subheader("β")
|
| 140 |
st.write("**Icon**")
|
| 141 |
-
emojis = list(json.load(open("subpages/emoji-en-US.json")).keys())
|
| 142 |
for label in labels:
|
| 143 |
if f"icon_{label}" not in st.session_state:
|
| 144 |
st.session_state[f"icon_{label}"] = classmap[label]
|
|
|
|
| 6 |
|
| 7 |
from data import get_data
|
| 8 |
from subpages.page import Context, Page
|
| 9 |
+
from utils import PROJ, classmap, color_map_color
|
| 10 |
|
| 11 |
_SENTENCE_ENCODER_MODEL = (
|
| 12 |
"sentence-transformers/all-MiniLM-L6-v2",
|
|
|
|
| 138 |
with col2b:
|
| 139 |
st.subheader("β")
|
| 140 |
st.write("**Icon**")
|
| 141 |
+
emojis = list(json.load(open(PROJ / "subpages/emoji-en-US.json")).keys())
|
| 142 |
for label in labels:
|
| 143 |
if f"icon_{label}" not in st.session_state:
|
| 144 |
st.session_state[f"icon_{label}"] = classmap[label]
|
{subpages β src/subpages}/inspect.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/losses.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/lossy_samples.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/metrics.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/misclassified.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/page.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/probing.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/random_samples.py
RENAMED
|
File without changes
|
{subpages β src/subpages}/raw_data.py
RENAMED
|
File without changes
|
utils.py β src/utils.py
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import matplotlib as matplotlib
|
| 2 |
import matplotlib.cm as cm
|
| 3 |
import pandas as pd
|
|
@@ -7,6 +9,8 @@ import torch
|
|
| 7 |
import torch.nn.functional as F
|
| 8 |
from st_aggrid import AgGrid, GridOptionsBuilder, GridUpdateMode
|
| 9 |
|
|
|
|
|
|
|
| 10 |
tokenizer_hash_funcs = {
|
| 11 |
tokenizers.Tokenizer: lambda _: None,
|
| 12 |
tokenizers.AddedToken: lambda _: None,
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
import matplotlib as matplotlib
|
| 4 |
import matplotlib.cm as cm
|
| 5 |
import pandas as pd
|
|
|
|
| 9 |
import torch.nn.functional as F
|
| 10 |
from st_aggrid import AgGrid, GridOptionsBuilder, GridUpdateMode
|
| 11 |
|
| 12 |
+
PROJ = Path(__file__).parent
|
| 13 |
+
|
| 14 |
tokenizer_hash_funcs = {
|
| 15 |
tokenizers.Tokenizer: lambda _: None,
|
| 16 |
tokenizers.AddedToken: lambda _: None,
|