e-mon commited on
Commit
fc4008d
·
1 Parent(s): 9abe511
Files changed (2) hide show
  1. src/display/formatting.py +0 -10
  2. src/populate.py +3 -8
src/display/formatting.py CHANGED
@@ -2,21 +2,11 @@ def model_hyperlink(link, model_name):
2
  return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
3
 
4
 
5
- def model_hyperlink_with_shot(link, model_name, num_few_shot):
6
- display_name = f"{model_name} ({num_few_shot}-shot)"
7
- return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{display_name}</a>'
8
-
9
-
10
  def make_clickable_model(model_name):
11
  link = f"https://huggingface.co/{model_name}"
12
  return model_hyperlink(link, model_name)
13
 
14
 
15
- def make_clickable_model_with_shot(model_name, num_few_shot):
16
- link = f"https://huggingface.co/{model_name}"
17
- return model_hyperlink_with_shot(link, model_name, num_few_shot)
18
-
19
-
20
  def styled_error(error):
21
  return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
22
 
 
2
  return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
3
 
4
 
 
 
 
 
 
5
  def make_clickable_model(model_name):
6
  link = f"https://huggingface.co/{model_name}"
7
  return model_hyperlink(link, model_name)
8
 
9
 
 
 
 
 
 
10
  def styled_error(error):
11
  return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
12
 
src/populate.py CHANGED
@@ -5,7 +5,7 @@ import datasets
5
  import pandas as pd
6
 
7
  from src.about import Tasks
8
- from src.display.formatting import has_no_nan_values, make_clickable_model, make_clickable_model_with_shot
9
  from src.display.utils import AutoEvalColumn, EvalQueueColumn
10
 
11
  # The values of these columns are in the range of 0-100
@@ -24,8 +24,7 @@ COLUMNS_TO_NORMALIZE = [
24
 
25
  def get_leaderboard_df(contents_repo: str, cols: list[str], benchmark_cols: list[str]) -> pd.DataFrame:
26
  df = datasets.load_dataset(contents_repo, split="train").to_pandas()
27
- # df["Model"] = df["model"].map(make_clickable_model)
28
- df["Model"] = df.apply(lambda x: make_clickable_model_with_shot(x["model"], x["num_few_shot"]), axis=1)
29
  df["T"] = df["model_type"].map(lambda x: x.split(":")[0].strip())
30
  df = df.rename(columns={task.value.metric: task.value.col_name for task in Tasks})
31
 
@@ -84,11 +83,7 @@ def get_evaluation_queue_df(save_path: str, cols: list[str]) -> list[pd.DataFram
84
  with open(file_path) as fp:
85
  data = json.load(fp)
86
 
87
- # data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
88
- data[EvalQueueColumn.model.name] = make_clickable_model_with_shot(
89
- data["model"],
90
- data["num_few_shot"], # num_few_shotは必ず存在するため、直接参照
91
- )
92
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")
93
 
94
  all_evals.append(data)
 
5
  import pandas as pd
6
 
7
  from src.about import Tasks
8
+ from src.display.formatting import has_no_nan_values, make_clickable_model
9
  from src.display.utils import AutoEvalColumn, EvalQueueColumn
10
 
11
  # The values of these columns are in the range of 0-100
 
24
 
25
  def get_leaderboard_df(contents_repo: str, cols: list[str], benchmark_cols: list[str]) -> pd.DataFrame:
26
  df = datasets.load_dataset(contents_repo, split="train").to_pandas()
27
+ df["Model"] = df["model"].map(make_clickable_model)
 
28
  df["T"] = df["model_type"].map(lambda x: x.split(":")[0].strip())
29
  df = df.rename(columns={task.value.metric: task.value.col_name for task in Tasks})
30
 
 
83
  with open(file_path) as fp:
84
  data = json.load(fp)
85
 
86
+ data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
 
 
 
 
87
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")
88
 
89
  all_evals.append(data)