Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
2bee5cb
1 Parent(s): a3d4c8d

refactor: remove the duplicate func

Browse files
Files changed (5) hide show
  1. src/benchmarks.py +1 -7
  2. src/columns.py +2 -0
  3. src/loaders.py +1 -7
  4. src/models.py +7 -6
  5. src/utils.py +1 -7
src/benchmarks.py CHANGED
@@ -4,13 +4,7 @@ from enum import Enum
4
  from air_benchmark.tasks.tasks import BenchmarkTable
5
 
6
  from src.envs import BENCHMARK_VERSION_LIST, METRIC_LIST
7
- from src.models import TaskType
8
-
9
-
10
- def get_safe_name(name: str):
11
- """Get RFC 1123 compatible safe name"""
12
- name = name.replace("-", "_")
13
- return "".join(character.lower() for character in name if (character.isalnum() or character == "_"))
14
 
15
 
16
  @dataclass
 
4
  from air_benchmark.tasks.tasks import BenchmarkTable
5
 
6
  from src.envs import BENCHMARK_VERSION_LIST, METRIC_LIST
7
+ from src.models import TaskType, get_safe_name
 
 
 
 
 
 
8
 
9
 
10
  @dataclass
src/columns.py CHANGED
@@ -95,3 +95,5 @@ COL_NAME_RANK = "Rank 🏆"
95
  COL_NAME_REVISION = "Revision"
96
  COL_NAME_TIMESTAMP = "Submission Date"
97
  COL_NAME_IS_ANONYMOUS = "Anonymous Submission"
 
 
 
95
  COL_NAME_REVISION = "Revision"
96
  COL_NAME_TIMESTAMP = "Submission Date"
97
  COL_NAME_IS_ANONYMOUS = "Anonymous Submission"
98
+
99
+
src/loaders.py CHANGED
@@ -5,7 +5,7 @@ import pandas as pd
5
 
6
  from src.columns import COL_NAME_IS_ANONYMOUS, COL_NAME_REVISION, COL_NAME_TIMESTAMP
7
  from src.envs import BENCHMARK_VERSION_LIST, DEFAULT_METRIC_LONG_DOC, DEFAULT_METRIC_QA
8
- from src.models import FullEvalResult, LeaderboardDataStore, TaskType
9
  from src.utils import get_default_cols, get_leaderboard_df
10
 
11
  pd.options.mode.copy_on_write = True
@@ -50,12 +50,6 @@ def load_raw_eval_results(results_path: str) -> List[FullEvalResult]:
50
  return results
51
 
52
 
53
- def get_safe_name(name: str):
54
- """Get RFC 1123 compatible safe name"""
55
- name = name.replace("-", "_")
56
- return "".join(character.lower() for character in name if (character.isalnum() or character == "_"))
57
-
58
-
59
  def load_leaderboard_datastore(file_path, version) -> LeaderboardDataStore:
60
  slug = get_safe_name(version)[-4:]
61
  datastore = LeaderboardDataStore(version, slug, None, None, None, None, None, None, None, None)
 
5
 
6
  from src.columns import COL_NAME_IS_ANONYMOUS, COL_NAME_REVISION, COL_NAME_TIMESTAMP
7
  from src.envs import BENCHMARK_VERSION_LIST, DEFAULT_METRIC_LONG_DOC, DEFAULT_METRIC_QA
8
+ from src.models import FullEvalResult, LeaderboardDataStore, TaskType, get_safe_name
9
  from src.utils import get_default_cols, get_leaderboard_df
10
 
11
  pd.options.mode.copy_on_write = True
 
50
  return results
51
 
52
 
 
 
 
 
 
 
53
  def load_leaderboard_datastore(file_path, version) -> LeaderboardDataStore:
54
  slug = get_safe_name(version)[-4:]
55
  datastore = LeaderboardDataStore(version, slug, None, None, None, None, None, None, None, None)
src/models.py CHANGED
@@ -17,12 +17,6 @@ from src.columns import (
17
  )
18
 
19
 
20
- def get_safe_name(name: str):
21
- """Get RFC 1123 compatible safe name"""
22
- name = name.replace("-", "_")
23
- return "".join(character.lower() for character in name if (character.isalnum() or character == "_"))
24
-
25
-
26
  @dataclass
27
  class EvalResult:
28
  """
@@ -170,3 +164,10 @@ def make_clickable_model(model_name: str, model_link: str):
170
 
171
  def model_hyperlink(link, model_name):
172
  return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
 
 
 
 
 
 
 
 
17
  )
18
 
19
 
 
 
 
 
 
 
20
  @dataclass
21
  class EvalResult:
22
  """
 
164
 
165
  def model_hyperlink(link, model_name):
166
  return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
167
+
168
+ def get_safe_name(name: str):
169
+ """Get RFC 1123 compatible safe name"""
170
+ name = name.replace("-", "_")
171
+ return "".join(character.lower() for character in name if (character.isalnum() or character == "_"))
172
+
173
+
src/utils.py CHANGED
@@ -19,7 +19,7 @@ from src.columns import (
19
  get_fixed_col_names_and_types,
20
  )
21
  from src.envs import API, LATEST_BENCHMARK_VERSION, SEARCH_RESULTS_REPO
22
- from src.models import TaskType
23
 
24
 
25
  def calculate_mean(row):
@@ -133,12 +133,6 @@ def select_columns(
133
  return filtered_df
134
 
135
 
136
- def get_safe_name(name: str):
137
- """Get RFC 1123 compatible safe name"""
138
- name = name.replace("-", "_")
139
- return "".join(character.lower() for character in name if (character.isalnum() or character == "_"))
140
-
141
-
142
  def _update_df_elem(
143
  task: TaskType,
144
  version: str,
 
19
  get_fixed_col_names_and_types,
20
  )
21
  from src.envs import API, LATEST_BENCHMARK_VERSION, SEARCH_RESULTS_REPO
22
+ from src.models import TaskType, get_safe_name
23
 
24
 
25
  def calculate_mean(row):
 
133
  return filtered_df
134
 
135
 
 
 
 
 
 
 
136
  def _update_df_elem(
137
  task: TaskType,
138
  version: str,