“WadoodAbdul”
commited on
Commit
•
4b57d62
1
Parent(s):
3a8ab9c
added model architecture filter
Browse files- app.py +31 -12
- src/display/utils.py +22 -0
- src/leaderboard/read_evals.py +14 -8
app.py
CHANGED
@@ -26,6 +26,7 @@ from src.display.utils import (
|
|
26 |
TYPES,
|
27 |
AutoEvalColumn,
|
28 |
ModelType,
|
|
|
29 |
Precision,
|
30 |
WeightType,
|
31 |
fields,
|
@@ -74,11 +75,12 @@ def update_table(
|
|
74 |
columns: list,
|
75 |
query: str,
|
76 |
type_query: list = None,
|
77 |
-
|
78 |
size_query: list = None,
|
|
|
79 |
show_deleted: bool = False,
|
80 |
):
|
81 |
-
filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
|
82 |
filtered_df = filter_queries(query, filtered_df)
|
83 |
df = select_columns(filtered_df, columns, list(hidden_df.columns))
|
84 |
return df
|
@@ -122,7 +124,7 @@ def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
|
|
122 |
|
123 |
|
124 |
def filter_models(
|
125 |
-
df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
|
126 |
) -> pd.DataFrame:
|
127 |
# Show all models
|
128 |
# if show_deleted:
|
@@ -136,6 +138,11 @@ def filter_models(
|
|
136 |
type_emoji = [t[0] for t in type_query]
|
137 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
if precision_query is not None:
|
140 |
if AutoEvalColumn.precision.name in df.columns:
|
141 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
@@ -184,19 +191,19 @@ with demo:
|
|
184 |
with gr.Column(min_width=320):
|
185 |
# with gr.Box(elem_id="box-filter"):
|
186 |
filter_columns_type = gr.CheckboxGroup(
|
187 |
-
label="Model
|
188 |
choices=[t.to_str() for t in ModelType],
|
189 |
value=[t.to_str() for t in ModelType],
|
190 |
interactive=True,
|
191 |
elem_id="filter-columns-type",
|
192 |
)
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
# filter_columns_size = gr.CheckboxGroup(
|
201 |
# label="Model sizes (in billions of parameters)",
|
202 |
# choices=list(NUMERIC_INTERVALS.keys()),
|
@@ -227,13 +234,14 @@ with demo:
|
|
227 |
shown_columns,
|
228 |
search_bar,
|
229 |
filter_columns_type,
|
|
|
230 |
],
|
231 |
leaderboard_table,
|
232 |
)
|
233 |
for selector in [
|
234 |
shown_columns,
|
235 |
filter_columns_type,
|
236 |
-
|
237 |
# filter_columns_size,
|
238 |
# deleted_models_visibility,
|
239 |
]:
|
@@ -244,6 +252,7 @@ with demo:
|
|
244 |
shown_columns,
|
245 |
search_bar,
|
246 |
filter_columns_type,
|
|
|
247 |
],
|
248 |
leaderboard_table,
|
249 |
queue=True,
|
@@ -283,6 +292,13 @@ with demo:
|
|
283 |
interactive=True,
|
284 |
elem_id="filter-columns-type",
|
285 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
# filter_columns_precision = gr.CheckboxGroup(
|
287 |
# label="Precision",
|
288 |
# choices=[i.value.name for i in Precision],
|
@@ -321,12 +337,14 @@ with demo:
|
|
321 |
shown_columns,
|
322 |
search_bar,
|
323 |
filter_columns_type,
|
|
|
324 |
],
|
325 |
leaderboard_table,
|
326 |
)
|
327 |
for selector in [
|
328 |
shown_columns,
|
329 |
filter_columns_type,
|
|
|
330 |
# filter_columns_precision,
|
331 |
# filter_columns_size,
|
332 |
# deleted_models_visibility,
|
@@ -338,6 +356,7 @@ with demo:
|
|
338 |
shown_columns,
|
339 |
search_bar,
|
340 |
filter_columns_type,
|
|
|
341 |
],
|
342 |
leaderboard_table,
|
343 |
queue=True,
|
|
|
26 |
TYPES,
|
27 |
AutoEvalColumn,
|
28 |
ModelType,
|
29 |
+
ModelArch,
|
30 |
Precision,
|
31 |
WeightType,
|
32 |
fields,
|
|
|
75 |
columns: list,
|
76 |
query: str,
|
77 |
type_query: list = None,
|
78 |
+
architecture_query: list = None,
|
79 |
size_query: list = None,
|
80 |
+
precision_query: str = None,
|
81 |
show_deleted: bool = False,
|
82 |
):
|
83 |
+
filtered_df = filter_models(hidden_df, type_query, architecture_query, size_query, precision_query, show_deleted)
|
84 |
filtered_df = filter_queries(query, filtered_df)
|
85 |
df = select_columns(filtered_df, columns, list(hidden_df.columns))
|
86 |
return df
|
|
|
124 |
|
125 |
|
126 |
def filter_models(
|
127 |
+
df: pd.DataFrame, type_query: list, architecture_query: list, size_query: list, precision_query: list, show_deleted: bool
|
128 |
) -> pd.DataFrame:
|
129 |
# Show all models
|
130 |
# if show_deleted:
|
|
|
138 |
type_emoji = [t[0] for t in type_query]
|
139 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
140 |
|
141 |
+
if architecture_query is not None:
|
142 |
+
arch_types = [t for t in architecture_query]
|
143 |
+
filtered_df = filtered_df.loc[df[AutoEvalColumn.architecture.name].isin(arch_types)]
|
144 |
+
# filtered_df = filtered_df.loc[df[AutoEvalColumn.architecture.name].isin(architecture_query + ["None"])]
|
145 |
+
|
146 |
if precision_query is not None:
|
147 |
if AutoEvalColumn.precision.name in df.columns:
|
148 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
|
|
191 |
with gr.Column(min_width=320):
|
192 |
# with gr.Box(elem_id="box-filter"):
|
193 |
filter_columns_type = gr.CheckboxGroup(
|
194 |
+
label="Model Types",
|
195 |
choices=[t.to_str() for t in ModelType],
|
196 |
value=[t.to_str() for t in ModelType],
|
197 |
interactive=True,
|
198 |
elem_id="filter-columns-type",
|
199 |
)
|
200 |
+
filter_columns_architecture = gr.CheckboxGroup(
|
201 |
+
label="Architecture Types",
|
202 |
+
choices=[i.value.name for i in ModelArch],
|
203 |
+
value=[i.value.name for i in ModelArch],
|
204 |
+
interactive=True,
|
205 |
+
elem_id="filter-columns-architecture",
|
206 |
+
)
|
207 |
# filter_columns_size = gr.CheckboxGroup(
|
208 |
# label="Model sizes (in billions of parameters)",
|
209 |
# choices=list(NUMERIC_INTERVALS.keys()),
|
|
|
234 |
shown_columns,
|
235 |
search_bar,
|
236 |
filter_columns_type,
|
237 |
+
filter_columns_architecture
|
238 |
],
|
239 |
leaderboard_table,
|
240 |
)
|
241 |
for selector in [
|
242 |
shown_columns,
|
243 |
filter_columns_type,
|
244 |
+
filter_columns_architecture,
|
245 |
# filter_columns_size,
|
246 |
# deleted_models_visibility,
|
247 |
]:
|
|
|
252 |
shown_columns,
|
253 |
search_bar,
|
254 |
filter_columns_type,
|
255 |
+
filter_columns_architecture,
|
256 |
],
|
257 |
leaderboard_table,
|
258 |
queue=True,
|
|
|
292 |
interactive=True,
|
293 |
elem_id="filter-columns-type",
|
294 |
)
|
295 |
+
filter_columns_architecture = gr.CheckboxGroup(
|
296 |
+
label="Architecture Types",
|
297 |
+
choices=[i.value.name for i in ModelArch],
|
298 |
+
value=[i.value.name for i in ModelArch],
|
299 |
+
interactive=True,
|
300 |
+
elem_id="filter-columns-architecture",
|
301 |
+
)
|
302 |
# filter_columns_precision = gr.CheckboxGroup(
|
303 |
# label="Precision",
|
304 |
# choices=[i.value.name for i in Precision],
|
|
|
337 |
shown_columns,
|
338 |
search_bar,
|
339 |
filter_columns_type,
|
340 |
+
filter_columns_architecture,
|
341 |
],
|
342 |
leaderboard_table,
|
343 |
)
|
344 |
for selector in [
|
345 |
shown_columns,
|
346 |
filter_columns_type,
|
347 |
+
filter_columns_architecture,
|
348 |
# filter_columns_precision,
|
349 |
# filter_columns_size,
|
350 |
# deleted_models_visibility,
|
|
|
356 |
shown_columns,
|
357 |
search_bar,
|
358 |
filter_columns_type,
|
359 |
+
filter_columns_architecture,
|
360 |
],
|
361 |
leaderboard_table,
|
362 |
queue=True,
|
src/display/utils.py
CHANGED
@@ -39,6 +39,7 @@ for task in ClinicalTypes:
|
|
39 |
# Model information
|
40 |
auto_eval_column_dict.append(["model_type", ColumnContent, ColumnContent("Type", "str", False)])
|
41 |
auto_eval_column_dict.append(["architecture", ColumnContent, ColumnContent("Architecture", "str", False)])
|
|
|
42 |
auto_eval_column_dict.append(["weight_type", ColumnContent, ColumnContent("Weight type", "str", False, True)])
|
43 |
auto_eval_column_dict.append(["precision", ColumnContent, ColumnContent("Precision", "str", False, True)])
|
44 |
auto_eval_column_dict.append(["license", ColumnContent, ColumnContent("Hub License", "str", False)])
|
@@ -100,6 +101,27 @@ class ModelType(Enum):
|
|
100 |
# return ModelType.IFT
|
101 |
return ModelType.Unknown
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
class WeightType(Enum):
|
105 |
Adapter = ModelDetails("Adapter")
|
|
|
39 |
# Model information
|
40 |
auto_eval_column_dict.append(["model_type", ColumnContent, ColumnContent("Type", "str", False)])
|
41 |
auto_eval_column_dict.append(["architecture", ColumnContent, ColumnContent("Architecture", "str", False)])
|
42 |
+
auto_eval_column_dict.append(["backbone", ColumnContent, ColumnContent("Base Model", "str", False)])
|
43 |
auto_eval_column_dict.append(["weight_type", ColumnContent, ColumnContent("Weight type", "str", False, True)])
|
44 |
auto_eval_column_dict.append(["precision", ColumnContent, ColumnContent("Precision", "str", False, True)])
|
45 |
auto_eval_column_dict.append(["license", ColumnContent, ColumnContent("Hub License", "str", False)])
|
|
|
101 |
# return ModelType.IFT
|
102 |
return ModelType.Unknown
|
103 |
|
104 |
+
class ModelArch(Enum):
|
105 |
+
Encoder = ModelDetails("Encoder")
|
106 |
+
Decoder = ModelDetails("Decoder")
|
107 |
+
EncoderDecoder = ModelDetails("EncoderDecoder")
|
108 |
+
Unknown = ModelDetails(name="Other", symbol="?")
|
109 |
+
|
110 |
+
def to_str(self, separator=" "):
|
111 |
+
return f"{self.value.name}"
|
112 |
+
|
113 |
+
@staticmethod
|
114 |
+
def from_str(type):
|
115 |
+
if "encoder" in type:
|
116 |
+
return ModelArch.Encoder
|
117 |
+
if "decoder" in type:
|
118 |
+
return ModelArch.Decoder
|
119 |
+
if "encoder-decoder" in type:
|
120 |
+
return ModelArch.EncoderDecoder
|
121 |
+
# if "unknown" in type:
|
122 |
+
# return ModelArch.Unknown
|
123 |
+
return ModelArch.Unknown
|
124 |
+
|
125 |
|
126 |
class WeightType(Enum):
|
127 |
Adapter = ModelDetails("Adapter")
|
src/leaderboard/read_evals.py
CHANGED
@@ -8,7 +8,7 @@ import dateutil
|
|
8 |
import numpy as np
|
9 |
|
10 |
from src.display.formatting import make_clickable_model
|
11 |
-
from src.display.utils import AutoEvalColumn, ModelType, Precision, Tasks, WeightType, ClinicalTypes
|
12 |
from src.submission.check_validity import is_model_on_hub
|
13 |
|
14 |
|
@@ -27,6 +27,7 @@ class EvalResult:
|
|
27 |
model_type: ModelType = ModelType.Unknown # Pretrained, fine tuned, ...
|
28 |
weight_type: WeightType = WeightType.Original # Original or Adapter
|
29 |
architecture: str = "Unknown"
|
|
|
30 |
license: str = "?"
|
31 |
likes: int = 0
|
32 |
num_params: int = 0
|
@@ -43,7 +44,9 @@ class EvalResult:
|
|
43 |
|
44 |
# Precision
|
45 |
precision = Precision.from_str(config.get("model_dtype"))
|
|
|
46 |
model_type = ModelType.from_str(config.get("model_type", ""))
|
|
|
47 |
license = config.get("license", "?")
|
48 |
num_params = config.get("num_params", "?")
|
49 |
|
@@ -64,11 +67,11 @@ class EvalResult:
|
|
64 |
still_on_hub, _, model_config = is_model_on_hub(
|
65 |
full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False
|
66 |
)
|
67 |
-
|
68 |
if model_config is not None:
|
69 |
-
|
70 |
-
if
|
71 |
-
|
72 |
|
73 |
# Extract results available in this file (some results are split in several files)
|
74 |
dataset_results = {}
|
@@ -105,7 +108,8 @@ class EvalResult:
|
|
105 |
precision=precision,
|
106 |
revision=config.get("model_sha", ""),
|
107 |
still_on_hub=still_on_hub,
|
108 |
-
architecture=
|
|
|
109 |
model_type=model_type,
|
110 |
num_params=num_params,
|
111 |
license=license
|
@@ -141,7 +145,8 @@ class EvalResult:
|
|
141 |
AutoEvalColumn.model_type.name: self.model_type.value.name,
|
142 |
AutoEvalColumn.model_type_symbol.name: self.model_type.value.symbol,
|
143 |
AutoEvalColumn.weight_type.name: self.weight_type.value.name,
|
144 |
-
AutoEvalColumn.architecture.name: self.architecture,
|
|
|
145 |
AutoEvalColumn.model.name: make_clickable_model(self.full_model),
|
146 |
AutoEvalColumn.revision.name: self.revision,
|
147 |
AutoEvalColumn.average.name: average,
|
@@ -164,7 +169,8 @@ class EvalResult:
|
|
164 |
AutoEvalColumn.model_type.name: self.model_type.value.name,
|
165 |
AutoEvalColumn.model_type_symbol.name: self.model_type.value.symbol,
|
166 |
AutoEvalColumn.weight_type.name: self.weight_type.value.name,
|
167 |
-
AutoEvalColumn.architecture.name: self.architecture,
|
|
|
168 |
AutoEvalColumn.model.name: make_clickable_model(self.full_model),
|
169 |
AutoEvalColumn.revision.name: self.revision,
|
170 |
AutoEvalColumn.average.name: average,
|
|
|
8 |
import numpy as np
|
9 |
|
10 |
from src.display.formatting import make_clickable_model
|
11 |
+
from src.display.utils import AutoEvalColumn, ModelType, ModelArch, Precision, Tasks, WeightType, ClinicalTypes
|
12 |
from src.submission.check_validity import is_model_on_hub
|
13 |
|
14 |
|
|
|
27 |
model_type: ModelType = ModelType.Unknown # Pretrained, fine tuned, ...
|
28 |
weight_type: WeightType = WeightType.Original # Original or Adapter
|
29 |
architecture: str = "Unknown"
|
30 |
+
backbone:str = "Unknown"
|
31 |
license: str = "?"
|
32 |
likes: int = 0
|
33 |
num_params: int = 0
|
|
|
44 |
|
45 |
# Precision
|
46 |
precision = Precision.from_str(config.get("model_dtype"))
|
47 |
+
model_architecture = ModelArch.from_str(config.get("architecture"))
|
48 |
model_type = ModelType.from_str(config.get("model_type", ""))
|
49 |
+
# print(model_architecture, model_type)
|
50 |
license = config.get("license", "?")
|
51 |
num_params = config.get("num_params", "?")
|
52 |
|
|
|
67 |
still_on_hub, _, model_config = is_model_on_hub(
|
68 |
full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False
|
69 |
)
|
70 |
+
backbone = "?"
|
71 |
if model_config is not None:
|
72 |
+
backbones = getattr(model_config, "architectures", None)
|
73 |
+
if backbones:
|
74 |
+
backbone = ";".join(backbones)
|
75 |
|
76 |
# Extract results available in this file (some results are split in several files)
|
77 |
dataset_results = {}
|
|
|
108 |
precision=precision,
|
109 |
revision=config.get("model_sha", ""),
|
110 |
still_on_hub=still_on_hub,
|
111 |
+
architecture=model_architecture,
|
112 |
+
backbone=backbone,
|
113 |
model_type=model_type,
|
114 |
num_params=num_params,
|
115 |
license=license
|
|
|
145 |
AutoEvalColumn.model_type.name: self.model_type.value.name,
|
146 |
AutoEvalColumn.model_type_symbol.name: self.model_type.value.symbol,
|
147 |
AutoEvalColumn.weight_type.name: self.weight_type.value.name,
|
148 |
+
AutoEvalColumn.architecture.name: self.architecture.name,
|
149 |
+
AutoEvalColumn.backbone.name: self.backbone,
|
150 |
AutoEvalColumn.model.name: make_clickable_model(self.full_model),
|
151 |
AutoEvalColumn.revision.name: self.revision,
|
152 |
AutoEvalColumn.average.name: average,
|
|
|
169 |
AutoEvalColumn.model_type.name: self.model_type.value.name,
|
170 |
AutoEvalColumn.model_type_symbol.name: self.model_type.value.symbol,
|
171 |
AutoEvalColumn.weight_type.name: self.weight_type.value.name,
|
172 |
+
AutoEvalColumn.architecture.name: self.architecture.name,
|
173 |
+
AutoEvalColumn.backbone.name: self.backbone,
|
174 |
AutoEvalColumn.model.name: make_clickable_model(self.full_model),
|
175 |
AutoEvalColumn.revision.name: self.revision,
|
176 |
AutoEvalColumn.average.name: average,
|