Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -145,29 +145,30 @@ def filter_models(
|
|
145 |
) -> pd.DataFrame:
|
146 |
print(f"Initial df shape: {df.shape}")
|
147 |
print(f"Initial df columns: {df.columns}")
|
|
|
148 |
|
149 |
filtered_df = df
|
150 |
|
151 |
# モデルタイプでフィルタリング
|
152 |
type_emoji = [t.split()[0] for t in type_query]
|
153 |
-
filtered_df = filtered_df[filtered_df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
154 |
print(f"After type filter: {filtered_df.shape}")
|
155 |
|
156 |
# Precisionでフィルタリング
|
157 |
-
filtered_df = filtered_df[filtered_df[AutoEvalColumn.precision.name].isin(precision_query + ["None", "Unknown"])]
|
158 |
print(f"After precision filter: {filtered_df.shape}")
|
159 |
|
160 |
# Add Special Tokensでフィルタリング
|
161 |
-
filtered_df = filtered_df[filtered_df[AutoEvalColumn.add_special_tokens.name].isin(add_special_tokens_query + ["Unknown"])]
|
162 |
print(f"After add_special_tokens filter: {filtered_df.shape}")
|
163 |
|
164 |
# Num Few Shotsでフィルタリング
|
165 |
-
filtered_df = filtered_df[filtered_df[AutoEvalColumn.num_few_shots.name].isin(num_few_shots_query + ["Unknown"])]
|
166 |
print(f"After num_few_shots filter: {filtered_df.shape}")
|
167 |
|
168 |
# モデルサイズでフィルタリング
|
169 |
if "Unknown" in size_query:
|
170 |
-
size_mask = filtered_df[AutoEvalColumn.params.name].isna()
|
171 |
else:
|
172 |
numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query if s != "Unknown"]))
|
173 |
params_column = pd.to_numeric(filtered_df[AutoEvalColumn.params.name], errors="coerce")
|
@@ -265,19 +266,19 @@ with demo:
|
|
265 |
leaderboard_df_filtered = filter_models(leaderboard_df, [t.to_str(" ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
|
266 |
|
267 |
# 列名の重複を解消
|
268 |
-
leaderboard_df_filtered.columns = pd.io.parsers.
|
269 |
|
270 |
leaderboard_table = gr.components.Dataframe(
|
271 |
value=leaderboard_df_filtered,
|
272 |
headers=list(leaderboard_df_filtered.columns),
|
273 |
-
datatype={col: str
|
274 |
elem_id="leaderboard-table",
|
275 |
interactive=False,
|
276 |
visible=True,
|
277 |
)
|
278 |
print("Leaderboard table initial value:")
|
279 |
print(leaderboard_table.value)
|
280 |
-
print(f"Leaderboard table shape: {leaderboard_table.value.shape}")
|
281 |
|
282 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
283 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
|
|
145 |
) -> pd.DataFrame:
|
146 |
print(f"Initial df shape: {df.shape}")
|
147 |
print(f"Initial df columns: {df.columns}")
|
148 |
+
print(f"Initial df content:\n{df}")
|
149 |
|
150 |
filtered_df = df
|
151 |
|
152 |
# モデルタイプでフィルタリング
|
153 |
type_emoji = [t.split()[0] for t in type_query]
|
154 |
+
filtered_df = filtered_df[filtered_df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji + ["?"])]
|
155 |
print(f"After type filter: {filtered_df.shape}")
|
156 |
|
157 |
# Precisionでフィルタリング
|
158 |
+
filtered_df = filtered_df[filtered_df[AutoEvalColumn.precision.name].isin(precision_query + ["None", "Unknown", "?"])]
|
159 |
print(f"After precision filter: {filtered_df.shape}")
|
160 |
|
161 |
# Add Special Tokensでフィルタリング
|
162 |
+
filtered_df = filtered_df[filtered_df[AutoEvalColumn.add_special_tokens.name].isin(add_special_tokens_query + ["Unknown", "?"])]
|
163 |
print(f"After add_special_tokens filter: {filtered_df.shape}")
|
164 |
|
165 |
# Num Few Shotsでフィルタリング
|
166 |
+
filtered_df = filtered_df[filtered_df[AutoEvalColumn.num_few_shots.name].isin(num_few_shots_query + ["Unknown", "?"])]
|
167 |
print(f"After num_few_shots filter: {filtered_df.shape}")
|
168 |
|
169 |
# モデルサイズでフィルタリング
|
170 |
if "Unknown" in size_query:
|
171 |
+
size_mask = filtered_df[AutoEvalColumn.params.name].isna() | (filtered_df[AutoEvalColumn.params.name] == "Unknown")
|
172 |
else:
|
173 |
numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query if s != "Unknown"]))
|
174 |
params_column = pd.to_numeric(filtered_df[AutoEvalColumn.params.name], errors="coerce")
|
|
|
266 |
leaderboard_df_filtered = filter_models(leaderboard_df, [t.to_str(" ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
|
267 |
|
268 |
# 列名の重複を解消
|
269 |
+
leaderboard_df_filtered.columns = pd.io.parsers.readers._maybe_dedup_names(leaderboard_df_filtered.columns)
|
270 |
|
271 |
leaderboard_table = gr.components.Dataframe(
|
272 |
value=leaderboard_df_filtered,
|
273 |
headers=list(leaderboard_df_filtered.columns),
|
274 |
+
datatype={col: "str" for col in leaderboard_df_filtered.columns},
|
275 |
elem_id="leaderboard-table",
|
276 |
interactive=False,
|
277 |
visible=True,
|
278 |
)
|
279 |
print("Leaderboard table initial value:")
|
280 |
print(leaderboard_table.value)
|
281 |
+
print(f"Leaderboard table shape: {leaderboard_table.value.shape if isinstance(leaderboard_table.value, pd.DataFrame) else len(leaderboard_table.value)}")
|
282 |
|
283 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
284 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|