Yyy0530 commited on
Commit
f38d51c
·
1 Parent(s): 608af1a

优化平均分计算逻辑,更新模型类型过滤功能,完善用户界面说明

Browse files
app - 副本.py CHANGED
@@ -16,8 +16,8 @@ for setting in CONFIG['settings']:
16
  file_path = os.path.join("data", f"{CONFIG['settings_mapping'][setting]}-{data_type}.xlsx")
17
  df = pd.read_excel(file_path)
18
 
19
- # 添加平均分列,计算除第一列和最后一列之外的均值
20
- df["Average"] = df.iloc[:, 1:-1].mean(axis=1)
21
 
22
  # 添加 Rank 列,根据 Average 降序排名
23
  df["Rank"] = df["Average"].rank(ascending=False, method='min').astype(int)
@@ -106,13 +106,10 @@ table > tbody > tr > td:not(:nth-child(2)) {
106
 
107
  # 模型类型和模型大小(数值区间)设置
108
  MODEL_TYPES = [
109
- "Open",
110
- "Proprietary",
111
- "Sentence Transformers",
112
- "Cross-Encoders",
113
- "Bi-Encoders",
114
- "Uses Instructions",
115
- "No Instructions",
116
  ]
117
 
118
  NUMERIC_INTERVALS = {
@@ -123,7 +120,7 @@ NUMERIC_INTERVALS = {
123
  ">1B": pd.Interval(1000, 1_000_000, closed='right'),
124
  }
125
 
126
- # 定义过滤函数,实现搜索模型大小过滤功能
127
  def filter_data(search_query, model_types, model_sizes):
128
  outputs = []
129
  for setting in CONFIG['settings']:
@@ -136,10 +133,9 @@ def filter_data(search_query, model_types, model_sizes):
136
  mask_search = df["Model"].str.lower().apply(lambda x: any(q in x for q in queries))
137
  df = df[mask_search]
138
 
139
- # 模型类型过滤(占位逻辑)
140
- # if set(model_types) != set(MODEL_TYPES):
141
- # # 请在此处添加模型类型的过滤逻辑
142
- # pass
143
 
144
  # 模型大小过滤:将 "Number of Parameters" 转换为数值,并利用选定的区间进行过滤
145
  def parse_params(val):
@@ -180,7 +176,7 @@ with gr.Blocks(css=css) as demo:
180
  Welcome to the Model Leaderboard Interface!
181
 
182
  - **Search**: Enter keywords for the model name in the search box. Use a semicolon (`;`) to separate multiple keywords.
183
- - **Model Type**: Choose the model type(s) you're interested in (currently a placeholder, pending further expansion).
184
  - **Model Size**: Select the parameter count range to filter models accordingly.
185
 
186
  Click the **Filter Data** button to update the display with the filtered data.
 
16
  file_path = os.path.join("data", f"{CONFIG['settings_mapping'][setting]}-{data_type}.xlsx")
17
  df = pd.read_excel(file_path)
18
 
19
+ # 添加平均分列,计算除第一列和倒数两列之外的均值
20
+ df["Average"] = df.iloc[:, 1:-2].mean(axis=1)
21
 
22
  # 添加 Rank 列,根据 Average 降序排名
23
  df["Rank"] = df["Average"].rank(ascending=False, method='min').astype(int)
 
106
 
107
  # 模型类型和模型大小(数值区间)设置
108
  MODEL_TYPES = [
109
+ "sparse retrieval",
110
+ "dense retrieval",
111
+ "embedding model",
112
+ "re-ranking model"
 
 
 
113
  ]
114
 
115
  NUMERIC_INTERVALS = {
 
120
  ">1B": pd.Interval(1000, 1_000_000, closed='right'),
121
  }
122
 
123
+ # 定义过滤函数,实现搜索模型类型及模型大小过滤功能
124
  def filter_data(search_query, model_types, model_sizes):
125
  outputs = []
126
  for setting in CONFIG['settings']:
 
133
  mask_search = df["Model"].str.lower().apply(lambda x: any(q in x for q in queries))
134
  df = df[mask_search]
135
 
136
+ # 模型类型过滤:假设 Excel 中存在 "Model Type" 列
137
+ if model_types and set(model_types) != set(MODEL_TYPES):
138
+ df = df[df["Model Type"].isin(model_types)]
 
139
 
140
  # 模型大小过滤:将 "Number of Parameters" 转换为数值,并利用选定的区间进行过滤
141
  def parse_params(val):
 
176
  Welcome to the Model Leaderboard Interface!
177
 
178
  - **Search**: Enter keywords for the model name in the search box. Use a semicolon (`;`) to separate multiple keywords.
179
+ - **Model Type**: Choose the model type(s) you're interested in.
180
  - **Model Size**: Select the parameter count range to filter models accordingly.
181
 
182
  Click the **Filter Data** button to update the display with the filtered data.
app.py CHANGED
@@ -16,8 +16,8 @@ for setting in CONFIG['settings']:
16
  file_path = os.path.join("data", f"{CONFIG['settings_mapping'][setting]}-{data_type}.xlsx")
17
  df = pd.read_excel(file_path)
18
 
19
- # 添加平均分列,计算除第一列和最后一列之外的均值
20
- df["Average"] = df.iloc[:, 1:-1].mean(axis=1)
21
 
22
  # 添加 Rank 列,根据 Average 降序排名
23
  df["Rank"] = df["Average"].rank(ascending=False, method='min').astype(int)
@@ -106,13 +106,10 @@ table > tbody > tr > td:not(:nth-child(2)) {
106
 
107
  # 模型类型和模型大小(数值区间)设置
108
  MODEL_TYPES = [
109
- "Open",
110
- "Proprietary",
111
- "Sentence Transformers",
112
- "Cross-Encoders",
113
- "Bi-Encoders",
114
- "Uses Instructions",
115
- "No Instructions",
116
  ]
117
 
118
  NUMERIC_INTERVALS = {
@@ -123,7 +120,7 @@ NUMERIC_INTERVALS = {
123
  ">1B": pd.Interval(1000, 1_000_000, closed='right'),
124
  }
125
 
126
- # 定义过滤函数,实现搜索模型大小过滤功能
127
  def filter_data(search_query, model_types, model_sizes):
128
  outputs = []
129
  for setting in CONFIG['settings']:
@@ -136,10 +133,9 @@ def filter_data(search_query, model_types, model_sizes):
136
  mask_search = df["Model"].str.lower().apply(lambda x: any(q in x for q in queries))
137
  df = df[mask_search]
138
 
139
- # 模型类型过滤(占位逻辑)
140
- # if set(model_types) != set(MODEL_TYPES):
141
- # # 请在此处添加模型类型的过滤逻辑
142
- # pass
143
 
144
  # 模型大小过滤:将 "Number of Parameters" 转换为数值,并利用选定的区间进行过滤
145
  def parse_params(val):
@@ -180,7 +176,7 @@ with gr.Blocks(css=css) as demo:
180
  Welcome to the Model Leaderboard Interface!
181
 
182
  - **Search**: Enter keywords for the model name in the search box. Use a semicolon (`;`) to separate multiple keywords.
183
- - **Model Type**: Choose the model type(s) you're interested in (currently a placeholder, pending further expansion).
184
  - **Model Size**: Select the parameter count range to filter models accordingly.
185
 
186
  Click the **Filter Data** button to update the display with the filtered data.
 
16
  file_path = os.path.join("data", f"{CONFIG['settings_mapping'][setting]}-{data_type}.xlsx")
17
  df = pd.read_excel(file_path)
18
 
19
+ # 添加平均分列,计算除第一列和倒数两列之外的均值
20
+ df["Average"] = df.iloc[:, 1:-2].mean(axis=1)
21
 
22
  # 添加 Rank 列,根据 Average 降序排名
23
  df["Rank"] = df["Average"].rank(ascending=False, method='min').astype(int)
 
106
 
107
  # 模型类型和模型大小(数值区间)设置
108
  MODEL_TYPES = [
109
+ "sparse retrieval",
110
+ "dense retrieval",
111
+ "embedding model",
112
+ "re-ranking model"
 
 
 
113
  ]
114
 
115
  NUMERIC_INTERVALS = {
 
120
  ">1B": pd.Interval(1000, 1_000_000, closed='right'),
121
  }
122
 
123
+ # 定义过滤函数,实现搜索模型类型及模型大小过滤功能
124
  def filter_data(search_query, model_types, model_sizes):
125
  outputs = []
126
  for setting in CONFIG['settings']:
 
133
  mask_search = df["Model"].str.lower().apply(lambda x: any(q in x for q in queries))
134
  df = df[mask_search]
135
 
136
+ # 模型类型过滤:假设 Excel 中存在 "Model Type" 列
137
+ if model_types and set(model_types) != set(MODEL_TYPES):
138
+ df = df[df["Model Type"].isin(model_types)]
 
139
 
140
  # 模型大小过滤:将 "Number of Parameters" 转换为数值,并利用选定的区间进行过滤
141
  def parse_params(val):
 
176
  Welcome to the Model Leaderboard Interface!
177
 
178
  - **Search**: Enter keywords for the model name in the search box. Use a semicolon (`;`) to separate multiple keywords.
179
+ - **Model Type**: Choose the model type(s) you're interested in.
180
  - **Model Size**: Select the parameter count range to filter models accordingly.
181
 
182
  Click the **Filter Data** button to update the display with the filtered data.
config.yaml CHANGED
@@ -14,6 +14,7 @@ metrics:
14
  - Prec@10
15
  - NDCG@10
16
  - Number of parameters
 
17
  settings_mapping:
18
  "w/ meta w/ inst": "w-w"
19
  "w/ meta w/o inst": "w-wo"
 
14
  - Prec@10
15
  - NDCG@10
16
  - Number of parameters
17
+ - Model type
18
  settings_mapping:
19
  "w/ meta w/ inst": "w-w"
20
  "w/ meta w/o inst": "w-wo"
data/w-w-API.xlsx CHANGED
Binary files a/data/w-w-API.xlsx and b/data/w-w-API.xlsx differ
 
data/w-w-Avg.xlsx CHANGED
Binary files a/data/w-w-Avg.xlsx and b/data/w-w-Avg.xlsx differ
 
data/w-w-Code.xlsx CHANGED
Binary files a/data/w-w-Code.xlsx and b/data/w-w-Code.xlsx differ
 
data/w-w-Customized.xlsx CHANGED
Binary files a/data/w-w-Customized.xlsx and b/data/w-w-Customized.xlsx differ
 
data/w-wo-API.xlsx CHANGED
Binary files a/data/w-wo-API.xlsx and b/data/w-wo-API.xlsx differ
 
data/w-wo-Avg.xlsx CHANGED
Binary files a/data/w-wo-Avg.xlsx and b/data/w-wo-Avg.xlsx differ
 
data/w-wo-Code.xlsx CHANGED
Binary files a/data/w-wo-Code.xlsx and b/data/w-wo-Code.xlsx differ
 
data/w-wo-Customized.xlsx CHANGED
Binary files a/data/w-wo-Customized.xlsx and b/data/w-wo-Customized.xlsx differ
 
data/wo-w-API.xlsx CHANGED
Binary files a/data/wo-w-API.xlsx and b/data/wo-w-API.xlsx differ
 
data/wo-w-Avg.xlsx CHANGED
Binary files a/data/wo-w-Avg.xlsx and b/data/wo-w-Avg.xlsx differ
 
data/wo-w-Code.xlsx CHANGED
Binary files a/data/wo-w-Code.xlsx and b/data/wo-w-Code.xlsx differ
 
data/wo-w-Customized.xlsx CHANGED
Binary files a/data/wo-w-Customized.xlsx and b/data/wo-w-Customized.xlsx differ
 
data/wo-wo-API.xlsx CHANGED
Binary files a/data/wo-wo-API.xlsx and b/data/wo-wo-API.xlsx differ
 
data/wo-wo-Avg.xlsx CHANGED
Binary files a/data/wo-wo-Avg.xlsx and b/data/wo-wo-Avg.xlsx differ
 
data/wo-wo-Code.xlsx CHANGED
Binary files a/data/wo-wo-Code.xlsx and b/data/wo-wo-Code.xlsx differ
 
data/wo-wo-Customized.xlsx CHANGED
Binary files a/data/wo-wo-Customized.xlsx and b/data/wo-wo-Customized.xlsx differ