Spaces:
Runtime error
Runtime error
Gregor Betz
commited on
visibility
Browse files- app.py +7 -1
- backend/data.py +18 -0
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr # type: ignore
|
| 2 |
import plotly.express as px # type: ignore
|
| 3 |
|
| 4 |
-
from backend.data import load_cot_data
|
| 5 |
from backend.envs import API, REPO_ID, TOKEN
|
| 6 |
|
| 7 |
logo1_url = "https://raw.githubusercontent.com/logikon-ai/cot-eval/main/assets/AI2_Logo_Square.png"
|
|
@@ -38,6 +38,7 @@ def plot_evals_init(model_id, plotly_mode, request: gr.Request):
|
|
| 38 |
def plot_evals(model_id, plotly_mode):
|
| 39 |
df = df_cot_err.copy()
|
| 40 |
df["selected"] = df_cot_err.model.apply(lambda x: "selected" if x==model_id else "-")
|
|
|
|
| 41 |
#df.sort_values(["selected", "model"], inplace=True, ascending=True) # has currently no effect with px.scatter
|
| 42 |
template = "plotly_dark" if plotly_mode=="dark" else "plotly"
|
| 43 |
fig = px.scatter(df, x="base accuracy", y="marginal acc. gain", color="selected", symbol="model",
|
|
@@ -48,6 +49,11 @@ def plot_evals(model_id, plotly_mode):
|
|
| 48 |
error_y="acc_gain-err", hover_data=['model', "cot accuracy"],
|
| 49 |
width=1200, height=700)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
fig.update_layout(
|
| 52 |
title={"automargin": True},
|
| 53 |
)
|
|
|
|
| 1 |
import gradio as gr # type: ignore
|
| 2 |
import plotly.express as px # type: ignore
|
| 3 |
|
| 4 |
+
from backend.data import load_cot_data, is_visible_model
|
| 5 |
from backend.envs import API, REPO_ID, TOKEN
|
| 6 |
|
| 7 |
logo1_url = "https://raw.githubusercontent.com/logikon-ai/cot-eval/main/assets/AI2_Logo_Square.png"
|
|
|
|
| 38 |
def plot_evals(model_id, plotly_mode):
|
| 39 |
df = df_cot_err.copy()
|
| 40 |
df["selected"] = df_cot_err.model.apply(lambda x: "selected" if x==model_id else "-")
|
| 41 |
+
df["visible"] = df_cot_err.model.apply(is_visible_model) | df.selected.eq("selected")
|
| 42 |
#df.sort_values(["selected", "model"], inplace=True, ascending=True) # has currently no effect with px.scatter
|
| 43 |
template = "plotly_dark" if plotly_mode=="dark" else "plotly"
|
| 44 |
fig = px.scatter(df, x="base accuracy", y="marginal acc. gain", color="selected", symbol="model",
|
|
|
|
| 49 |
error_y="acc_gain-err", hover_data=['model', "cot accuracy"],
|
| 50 |
width=1200, height=700)
|
| 51 |
|
| 52 |
+
fig.update_traces(
|
| 53 |
+
visible="legendonly",
|
| 54 |
+
selector=dict(visible=False)
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
fig.update_layout(
|
| 58 |
title={"automargin": True},
|
| 59 |
)
|
backend/data.py
CHANGED
|
@@ -9,6 +9,24 @@ from backend.envs import EVAL_DATASET, TRACES_DATASET, TOKEN, EVAL_RESULTS_PATH
|
|
| 9 |
|
| 10 |
|
| 11 |
SUBSETS = ["base","cot","orig"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def load_cot_data():
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
SUBSETS = ["base","cot","orig"]
|
| 12 |
+
INITIALLY_VISIBLE_MODELS = [
|
| 13 |
+
"01-ai/Yi-34B-Chat",
|
| 14 |
+
"Qwen/Qwen2-72B-Instruct",
|
| 15 |
+
"allenai/tulu-2-dpo-70b",
|
| 16 |
+
"google/gemma-2-2b-it",
|
| 17 |
+
"internlm/internlm2-chat-20b",
|
| 18 |
+
"meta-llama/Llama-2-70b-chat-hf",
|
| 19 |
+
"meta-llama/Meta-Llama-3.1-70B-Instruct",
|
| 20 |
+
"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
| 21 |
+
"microsoft/Phi-3-mini-4k-instruct",
|
| 22 |
+
"microsoft/Phi-3.5-MoE-instruct",
|
| 23 |
+
"mistralai/Mistral-7B-Instruct-v0.2",
|
| 24 |
+
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def is_visible_model(model: str) -> bool:
|
| 29 |
+
return model in INITIALLY_VISIBLE_MODELS
|
| 30 |
|
| 31 |
|
| 32 |
def load_cot_data():
|