hysts HF staff commited on
Commit
ed9d7e4
1 Parent(s): 90e7099

Add few-shot info in graphs

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -319,19 +319,20 @@ def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
319
  def plot_size_vs_score(df: pd.DataFrame, hidden_df: pd.DataFrame) -> go.Figure:
320
  df2 = hidden_df.iloc[df.index]
321
  df2 = df2[df2["#Params (B)"] > 0]
322
- df2 = df2[["model_name_for_query", "#Params (B)", "AVG"]]
323
  df2["AVG"] = df2["AVG"].astype(float)
324
- df2 = df2.rename(columns={"model_name_for_query": "Model"})
 
325
  df2["model_name_without_org_name"] = df2["Model"].str.split("/").str[-1]
326
  fig = px.scatter(
327
  df2,
328
  x="#Params (B)",
329
  y="AVG",
330
  text="model_name_without_org_name",
331
- hover_data=["Model"],
332
  )
333
  fig.update_traces(
334
- hovertemplate="<b>%{customdata[0]}</b><br>#Params: %{x:.2f}B<br>AVG: %{y:.4f}<extra></extra>",
335
  textposition="top right",
336
  )
337
  fig.update_layout(yaxis_range=[0, 1])
@@ -345,20 +346,21 @@ TASK_AVG_NAME_MAP = {
345
 
346
  def plot_average_scores(df: pd.DataFrame, hidden_df: pd.DataFrame) -> go.Figure:
347
  df2 = hidden_df.iloc[df.index]
348
- df2 = df2[["model_name_for_query"] + list(TASK_AVG_NAME_MAP.keys())]
349
- df2 = df2.rename(columns={"model_name_for_query": "Model"})
350
  df2 = df2.rename(columns=TASK_AVG_NAME_MAP)
351
- df2 = df2.set_index("Model").astype(float)
 
352
 
353
  fig = go.Figure()
354
- for i, (name, row) in enumerate(df2.iterrows()):
355
  visible = True if i < 3 else "legendonly" # Display only the first 3 models
356
  fig.add_trace(
357
  go.Scatterpolar(
358
  r=row.values,
359
  theta=row.index,
360
  fill="toself",
361
- name=name,
362
  hovertemplate="%{theta}: %{r}",
363
  visible=visible,
364
  )
 
319
  def plot_size_vs_score(df: pd.DataFrame, hidden_df: pd.DataFrame) -> go.Figure:
320
  df2 = hidden_df.iloc[df.index]
321
  df2 = df2[df2["#Params (B)"] > 0]
322
+ df2 = df2[["model_name_for_query", "#Params (B)", "AVG", "Few-shot"]]
323
  df2["AVG"] = df2["AVG"].astype(float)
324
+ df2["Few-shot"] = df2["Few-shot"].astype(int)
325
+ df2 = df2.rename(columns={"model_name_for_query": "Model", "Few-shot": "n-shot"})
326
  df2["model_name_without_org_name"] = df2["Model"].str.split("/").str[-1]
327
  fig = px.scatter(
328
  df2,
329
  x="#Params (B)",
330
  y="AVG",
331
  text="model_name_without_org_name",
332
+ hover_data=["Model", "n-shot"],
333
  )
334
  fig.update_traces(
335
+ hovertemplate="<b>%{customdata[0]}</b><br>#Params: %{x:.2f}B<br>n-shot: %{customdata[1]}<br>AVG: %{y:.4f}<extra></extra>",
336
  textposition="top right",
337
  )
338
  fig.update_layout(yaxis_range=[0, 1])
 
346
 
347
  def plot_average_scores(df: pd.DataFrame, hidden_df: pd.DataFrame) -> go.Figure:
348
  df2 = hidden_df.iloc[df.index]
349
+ df2 = df2[["model_name_for_query", "Few-shot"] + list(TASK_AVG_NAME_MAP.keys())]
350
+ df2 = df2.rename(columns={"model_name_for_query": "Model", "Few-shot": "n-shot"})
351
  df2 = df2.rename(columns=TASK_AVG_NAME_MAP)
352
+ df2["n-shot"] = df2["n-shot"].astype(int)
353
+ df2 = df2.set_index(["Model", "n-shot"]).astype(float)
354
 
355
  fig = go.Figure()
356
+ for i, ((name, n_shot), row) in enumerate(df2.iterrows()):
357
  visible = True if i < 3 else "legendonly" # Display only the first 3 models
358
  fig.add_trace(
359
  go.Scatterpolar(
360
  r=row.values,
361
  theta=row.index,
362
  fill="toself",
363
+ name=f"{name} ({n_shot}-shot)",
364
  hovertemplate="%{theta}: %{r}",
365
  visible=visible,
366
  )