Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
98e75e7
1 Parent(s): f29af77

refactor: restructure the files

Browse files
Files changed (7) hide show
  1. app.py +1 -2
  2. src/columns.py +11 -12
  3. src/envs.py +0 -9
  4. src/loaders.py +1 -3
  5. src/models.py +3 -9
  6. src/utils.py +3 -8
  7. tests/test_utils.py +2 -9
app.py CHANGED
@@ -22,8 +22,6 @@ from src.css_html_js import custom_css
22
  from src.envs import (
23
  API,
24
  BENCHMARK_VERSION_LIST,
25
- COL_NAME_RERANKING_MODEL,
26
- COL_NAME_RETRIEVAL_MODEL,
27
  DEFAULT_METRIC_LONG_DOC,
28
  DEFAULT_METRIC_QA,
29
  EVAL_RESULTS_PATH,
@@ -33,6 +31,7 @@ from src.envs import (
33
  RESULTS_REPO,
34
  TOKEN,
35
  )
 
36
  from src.loaders import load_eval_results
37
  from src.models import TaskType, model_hyperlink
38
  from src.utils import remove_html, reset_rank, set_listeners, submit_results, update_metric, upload_file
 
22
  from src.envs import (
23
  API,
24
  BENCHMARK_VERSION_LIST,
 
 
25
  DEFAULT_METRIC_LONG_DOC,
26
  DEFAULT_METRIC_QA,
27
  EVAL_RESULTS_PATH,
 
31
  RESULTS_REPO,
32
  TOKEN,
33
  )
34
+ from src.columns import COL_NAME_RETRIEVAL_MODEL, COL_NAME_RERANKING_MODEL
35
  from src.loaders import load_eval_results
36
  from src.models import TaskType, model_hyperlink
37
  from src.utils import remove_html, reset_rank, set_listeners, submit_results, update_metric, upload_file
src/columns.py CHANGED
@@ -1,17 +1,5 @@
1
  from dataclasses import dataclass, make_dataclass
2
 
3
- from src.envs import (
4
- COL_NAME_AVG,
5
- COL_NAME_IS_ANONYMOUS,
6
- COL_NAME_RANK,
7
- COL_NAME_RERANKING_MODEL,
8
- COL_NAME_RERANKING_MODEL_LINK,
9
- COL_NAME_RETRIEVAL_MODEL,
10
- COL_NAME_RETRIEVAL_MODEL_LINK,
11
- COL_NAME_REVISION,
12
- COL_NAME_TIMESTAMP,
13
- )
14
-
15
 
16
  def fields(raw_class):
17
  return [v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"]
@@ -96,3 +84,14 @@ def get_default_col_names_and_types(benchmarks):
96
  def get_fixed_col_names_and_types():
97
  fixed_cols = get_default_auto_eval_column_dict()[:-3]
98
  return [c.name for _, _, c in fixed_cols], [c.type for _, _, c in fixed_cols]
 
 
 
 
 
 
 
 
 
 
 
 
1
  from dataclasses import dataclass, make_dataclass
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  def fields(raw_class):
5
  return [v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"]
 
84
  def get_fixed_col_names_and_types():
85
  fixed_cols = get_default_auto_eval_column_dict()[:-3]
86
  return [c.name for _, _, c in fixed_cols], [c.type for _, _, c in fixed_cols]
87
+
88
+
89
+ COL_NAME_AVG = "Average ⬆️"
90
+ COL_NAME_RETRIEVAL_MODEL = "Retrieval Method"
91
+ COL_NAME_RERANKING_MODEL = "Reranking Model"
92
+ COL_NAME_RETRIEVAL_MODEL_LINK = "Retrieval Model LINK"
93
+ COL_NAME_RERANKING_MODEL_LINK = "Reranking Model LINK"
94
+ COL_NAME_RANK = "Rank 🏆"
95
+ COL_NAME_REVISION = "Revision"
96
+ COL_NAME_TIMESTAMP = "Submission Date"
97
+ COL_NAME_IS_ANONYMOUS = "Anonymous Submission"
src/envs.py CHANGED
@@ -63,12 +63,3 @@ METRIC_LIST = [
63
  "mrr_at_100",
64
  "mrr_at_1000",
65
  ]
66
- COL_NAME_AVG = "Average ⬆️"
67
- COL_NAME_RETRIEVAL_MODEL = "Retrieval Method"
68
- COL_NAME_RERANKING_MODEL = "Reranking Model"
69
- COL_NAME_RETRIEVAL_MODEL_LINK = "Retrieval Model LINK"
70
- COL_NAME_RERANKING_MODEL_LINK = "Reranking Model LINK"
71
- COL_NAME_RANK = "Rank 🏆"
72
- COL_NAME_REVISION = "Revision"
73
- COL_NAME_TIMESTAMP = "Submission Date"
74
- COL_NAME_IS_ANONYMOUS = "Anonymous Submission"
 
63
  "mrr_at_100",
64
  "mrr_at_1000",
65
  ]
 
 
 
 
 
 
 
 
 
src/loaders.py CHANGED
@@ -5,12 +5,10 @@ import pandas as pd
5
 
6
  from src.envs import (
7
  BENCHMARK_VERSION_LIST,
8
- COL_NAME_IS_ANONYMOUS,
9
- COL_NAME_REVISION,
10
- COL_NAME_TIMESTAMP,
11
  DEFAULT_METRIC_LONG_DOC,
12
  DEFAULT_METRIC_QA,
13
  )
 
14
  from src.models import FullEvalResult, LeaderboardDataStore, TaskType
15
  from src.utils import get_default_cols, get_leaderboard_df
16
 
 
5
 
6
  from src.envs import (
7
  BENCHMARK_VERSION_LIST,
 
 
 
8
  DEFAULT_METRIC_LONG_DOC,
9
  DEFAULT_METRIC_QA,
10
  )
11
+ from src.columns import COL_NAME_REVISION, COL_NAME_TIMESTAMP, COL_NAME_IS_ANONYMOUS
12
  from src.models import FullEvalResult, LeaderboardDataStore, TaskType
13
  from src.utils import get_default_cols, get_leaderboard_df
14
 
src/models.py CHANGED
@@ -7,15 +7,9 @@ from typing import List, Optional
7
 
8
  import pandas as pd
9
 
10
- from src.envs import (
11
- COL_NAME_IS_ANONYMOUS,
12
- COL_NAME_RERANKING_MODEL,
13
- COL_NAME_RERANKING_MODEL_LINK,
14
- COL_NAME_RETRIEVAL_MODEL,
15
- COL_NAME_RETRIEVAL_MODEL_LINK,
16
- COL_NAME_REVISION,
17
- COL_NAME_TIMESTAMP,
18
- )
19
 
20
  def get_safe_name(name: str):
21
  """Get RFC 1123 compatible safe name"""
 
7
 
8
  import pandas as pd
9
 
10
+ from src.columns import COL_NAME_RETRIEVAL_MODEL, COL_NAME_RERANKING_MODEL, COL_NAME_RETRIEVAL_MODEL_LINK, \
11
+ COL_NAME_RERANKING_MODEL_LINK, COL_NAME_REVISION, COL_NAME_TIMESTAMP, COL_NAME_IS_ANONYMOUS
12
+
 
 
 
 
 
 
13
 
14
  def get_safe_name(name: str):
15
  """Get RFC 1123 compatible safe name"""
src/utils.py CHANGED
@@ -8,16 +8,11 @@ import pandas as pd
8
 
9
  from src.models import TaskType
10
  from src.benchmarks import LongDocBenchmarks, QABenchmarks
11
- from src.columns import get_default_col_names_and_types, get_fixed_col_names_and_types
 
 
12
  from src.envs import (
13
  API,
14
- COL_NAME_AVG,
15
- COL_NAME_IS_ANONYMOUS,
16
- COL_NAME_RANK,
17
- COL_NAME_RERANKING_MODEL,
18
- COL_NAME_RETRIEVAL_MODEL,
19
- COL_NAME_REVISION,
20
- COL_NAME_TIMESTAMP,
21
  LATEST_BENCHMARK_VERSION,
22
  SEARCH_RESULTS_REPO,
23
  )
 
8
 
9
  from src.models import TaskType
10
  from src.benchmarks import LongDocBenchmarks, QABenchmarks
11
+ from src.columns import get_default_col_names_and_types, get_fixed_col_names_and_types, COL_NAME_AVG, \
12
+ COL_NAME_RETRIEVAL_MODEL, COL_NAME_RERANKING_MODEL, COL_NAME_RANK, COL_NAME_REVISION, COL_NAME_TIMESTAMP, \
13
+ COL_NAME_IS_ANONYMOUS
14
  from src.envs import (
15
  API,
 
 
 
 
 
 
 
16
  LATEST_BENCHMARK_VERSION,
17
  SEARCH_RESULTS_REPO,
18
  )
tests/test_utils.py CHANGED
@@ -2,15 +2,8 @@ import pandas as pd
2
  import pytest
3
 
4
  from app import update_table
5
- from src.envs import (
6
- COL_NAME_AVG,
7
- COL_NAME_IS_ANONYMOUS,
8
- COL_NAME_RANK,
9
- COL_NAME_RERANKING_MODEL,
10
- COL_NAME_RETRIEVAL_MODEL,
11
- COL_NAME_REVISION,
12
- COL_NAME_TIMESTAMP,
13
- )
14
  from src.utils import (
15
  filter_models,
16
  filter_queries,
 
2
  import pytest
3
 
4
  from app import update_table
5
+ from src.columns import COL_NAME_AVG, COL_NAME_RETRIEVAL_MODEL, COL_NAME_RERANKING_MODEL, COL_NAME_RANK, \
6
+ COL_NAME_REVISION, COL_NAME_TIMESTAMP, COL_NAME_IS_ANONYMOUS
 
 
 
 
 
 
 
7
  from src.utils import (
8
  filter_models,
9
  filter_queries,