Spaces:
Runtime error
Runtime error
Archive project
Browse files- __pycache__/utils.cpython-38.pyc +0 -0
- app.py +185 -182
__pycache__/utils.cpython-38.pyc
ADDED
Binary file (661 Bytes). View file
|
|
app.py
CHANGED
@@ -126,191 +126,194 @@ def get_data_wrapper():
|
|
126 |
|
127 |
return dataframe
|
128 |
|
129 |
-
dataframe = get_data_wrapper()
|
130 |
|
131 |
st.markdown("# 🤗 Leaderboards")
|
132 |
-
|
133 |
-
|
134 |
-
if "first_query_params" not in st.session_state:
|
135 |
-
st.session_state.first_query_params = query_params
|
136 |
-
first_query_params = st.session_state.first_query_params
|
137 |
-
|
138 |
-
default_task = first_query_params.get("task", [None])[0]
|
139 |
-
default_only_verified = bool(int(first_query_params.get("only_verified", [0])[0]))
|
140 |
-
print(default_only_verified)
|
141 |
-
default_dataset = first_query_params.get("dataset", [None])[0]
|
142 |
-
default_split = first_query_params.get("split", [None])[0]
|
143 |
-
default_config = first_query_params.get("config", [None])[0]
|
144 |
-
default_metric = first_query_params.get("metric", [None])[0]
|
145 |
-
|
146 |
-
only_verified_results = st.sidebar.checkbox(
|
147 |
-
"Filter for Verified Results",
|
148 |
-
value=default_only_verified,
|
149 |
-
help="Select this checkbox if you want to see only results produced by the Hugging Face model evaluator, and no self-reported results."
|
150 |
-
)
|
151 |
-
|
152 |
-
selectable_tasks = list(set(dataframe.pipeline_tag))
|
153 |
-
if None in selectable_tasks:
|
154 |
-
selectable_tasks.remove(None)
|
155 |
-
selectable_tasks.sort(key=lambda name: name.lower())
|
156 |
-
selectable_tasks = ["-any-"] + selectable_tasks
|
157 |
-
|
158 |
-
task = st.sidebar.selectbox(
|
159 |
-
"Task",
|
160 |
-
selectable_tasks,
|
161 |
-
index=(selectable_tasks).index(default_task) if default_task in selectable_tasks else 0,
|
162 |
-
help="Filter the selectable datasets by task. Leave as \"-any-\" to see all selectable datasets."
|
163 |
-
)
|
164 |
-
|
165 |
-
if task != "-any-":
|
166 |
-
dataframe = dataframe[dataframe.pipeline_tag == task]
|
167 |
-
|
168 |
-
selectable_datasets = ["-any-"] + sorted(list(set(dataframe.dataset.tolist())), key=lambda name: name.lower())
|
169 |
-
if "" in selectable_datasets:
|
170 |
-
selectable_datasets.remove("")
|
171 |
-
|
172 |
-
dataset = st.sidebar.selectbox(
|
173 |
-
"Dataset",
|
174 |
-
selectable_datasets,
|
175 |
-
index=selectable_datasets.index(default_dataset) if default_dataset in selectable_datasets else 0,
|
176 |
-
help="Select a dataset to see the leaderboard!"
|
177 |
)
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
if
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
return dataframe
|
128 |
|
129 |
+
# dataframe = get_data_wrapper()
|
130 |
|
131 |
st.markdown("# 🤗 Leaderboards")
|
132 |
+
st.warning(
|
133 |
+
"**⚠️ This project has been archived. If you want to evaluate LLMs, checkout [this collection](https://huggingface.co/collections/clefourrier/llm-leaderboards-and-benchmarks-✨-64f99d2e11e92ca5568a7cce) of leaderboards.**"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
)
|
135 |
|
136 |
+
# query_params = st.experimental_get_query_params()
|
137 |
+
# if "first_query_params" not in st.session_state:
|
138 |
+
# st.session_state.first_query_params = query_params
|
139 |
+
# first_query_params = st.session_state.first_query_params
|
140 |
+
|
141 |
+
# default_task = first_query_params.get("task", [None])[0]
|
142 |
+
# default_only_verified = bool(int(first_query_params.get("only_verified", [0])[0]))
|
143 |
+
# print(default_only_verified)
|
144 |
+
# default_dataset = first_query_params.get("dataset", [None])[0]
|
145 |
+
# default_split = first_query_params.get("split", [None])[0]
|
146 |
+
# default_config = first_query_params.get("config", [None])[0]
|
147 |
+
# default_metric = first_query_params.get("metric", [None])[0]
|
148 |
|
149 |
+
# only_verified_results = st.sidebar.checkbox(
|
150 |
+
# "Filter for Verified Results",
|
151 |
+
# value=default_only_verified,
|
152 |
+
# help="Select this checkbox if you want to see only results produced by the Hugging Face model evaluator, and no self-reported results."
|
153 |
+
# )
|
154 |
+
|
155 |
+
# selectable_tasks = list(set(dataframe.pipeline_tag))
|
156 |
+
# if None in selectable_tasks:
|
157 |
+
# selectable_tasks.remove(None)
|
158 |
+
# selectable_tasks.sort(key=lambda name: name.lower())
|
159 |
+
# selectable_tasks = ["-any-"] + selectable_tasks
|
160 |
|
161 |
+
# task = st.sidebar.selectbox(
|
162 |
+
# "Task",
|
163 |
+
# selectable_tasks,
|
164 |
+
# index=(selectable_tasks).index(default_task) if default_task in selectable_tasks else 0,
|
165 |
+
# help="Filter the selectable datasets by task. Leave as \"-any-\" to see all selectable datasets."
|
166 |
+
# )
|
167 |
+
|
168 |
+
# if task != "-any-":
|
169 |
+
# dataframe = dataframe[dataframe.pipeline_tag == task]
|
170 |
+
|
171 |
+
# selectable_datasets = ["-any-"] + sorted(list(set(dataframe.dataset.tolist())), key=lambda name: name.lower())
|
172 |
+
# if "" in selectable_datasets:
|
173 |
+
# selectable_datasets.remove("")
|
174 |
+
|
175 |
+
# dataset = st.sidebar.selectbox(
|
176 |
+
# "Dataset",
|
177 |
+
# selectable_datasets,
|
178 |
+
# index=selectable_datasets.index(default_dataset) if default_dataset in selectable_datasets else 0,
|
179 |
+
# help="Select a dataset to see the leaderboard!"
|
180 |
+
# )
|
181 |
+
|
182 |
+
# dataframe = dataframe[dataframe.only_verified == only_verified_results]
|
183 |
+
|
184 |
+
# current_query_params = {"dataset": [dataset], "only_verified": [int(only_verified_results)], "task": [task]}
|
185 |
+
|
186 |
+
# st.experimental_set_query_params(**current_query_params)
|
187 |
+
|
188 |
+
# if dataset != "-any-":
|
189 |
+
# dataset_df = dataframe[dataframe.dataset == dataset]
|
190 |
+
# else:
|
191 |
+
# dataset_df = dataframe
|
192 |
+
|
193 |
+
# dataset_df = dataset_df.dropna(axis="columns", how="all")
|
194 |
+
|
195 |
+
# if len(dataset_df) > 0:
|
196 |
+
# selectable_configs = list(set(dataset_df["config"]))
|
197 |
+
# selectable_configs.sort(key=lambda name: name.lower())
|
198 |
+
|
199 |
+
# if "-unspecified-" in selectable_configs:
|
200 |
+
# selectable_configs.remove("-unspecified-")
|
201 |
+
# selectable_configs = ["-unspecified-"] + selectable_configs
|
202 |
+
|
203 |
+
# if dataset != "-any-":
|
204 |
+
# config = st.sidebar.selectbox(
|
205 |
+
# "Config",
|
206 |
+
# selectable_configs,
|
207 |
+
# index=selectable_configs.index(default_config) if default_config in selectable_configs else 0,
|
208 |
+
# help="Filter the results on the current leaderboard by the dataset config. Self-reported results might not report the config, which is why \"-unspecified-\" is an option."
|
209 |
+
# )
|
210 |
+
# dataset_df = dataset_df[dataset_df.config == config]
|
211 |
+
|
212 |
+
# selectable_splits = list(set(dataset_df["split"]))
|
213 |
+
# selectable_splits.sort(key=lambda name: name.lower())
|
214 |
+
|
215 |
+
# if "-unspecified-" in selectable_splits:
|
216 |
+
# selectable_splits.remove("-unspecified-")
|
217 |
+
# selectable_splits = ["-unspecified-"] + selectable_splits
|
218 |
+
|
219 |
+
# split = st.sidebar.selectbox(
|
220 |
+
# "Split",
|
221 |
+
# selectable_splits,
|
222 |
+
# index=selectable_splits.index(default_split) if default_split in selectable_splits else 0,
|
223 |
+
# help="Filter the results on the current leaderboard by the dataset split. Self-reported results might not report the split, which is why \"-unspecified-\" is an option."
|
224 |
+
# )
|
225 |
+
|
226 |
+
# current_query_params.update({"config": [config], "split": [split]})
|
227 |
+
|
228 |
+
# st.experimental_set_query_params(**current_query_params)
|
229 |
+
|
230 |
+
# dataset_df = dataset_df[dataset_df.split == split]
|
231 |
+
|
232 |
+
# not_selectable_metrics = ["model_id", "dataset", "split", "config", "pipeline_tag", "only_verified"]
|
233 |
+
# selectable_metrics = list(filter(lambda column: column not in not_selectable_metrics, dataset_df.columns))
|
234 |
+
|
235 |
+
# dataset_df = dataset_df.filter(["model_id"] + (["dataset"] if dataset == "-any-" else []) + selectable_metrics)
|
236 |
+
# dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|
237 |
+
|
238 |
+
# sorting_metric = st.sidebar.radio(
|
239 |
+
# "Sorting Metric",
|
240 |
+
# selectable_metrics,
|
241 |
+
# index=selectable_metrics.index(default_metric) if default_metric in selectable_metrics else 0,
|
242 |
+
# help="Select the metric to sort the leaderboard by. Click on the metric name in the leaderboard to reverse the sorting order."
|
243 |
+
# )
|
244 |
+
|
245 |
+
# current_query_params.update({"metric": [sorting_metric]})
|
246 |
+
|
247 |
+
# st.experimental_set_query_params(**current_query_params)
|
248 |
+
|
249 |
+
# st.markdown(
|
250 |
+
# "Please click on the model's name to be redirected to its model card."
|
251 |
+
# )
|
252 |
+
|
253 |
+
# st.markdown(
|
254 |
+
# "Want to beat the leaderboard? Don't see your model here? Simply request an automatic evaluation [here](https://huggingface.co/spaces/autoevaluate/model-evaluator)."
|
255 |
+
# )
|
256 |
+
|
257 |
+
# st.markdown(
|
258 |
+
# "If you do not see your self-reported results here, ensure that your results are in the expected range for all metrics. E.g., accuracy is 0-1, not 0-100."
|
259 |
+
# )
|
260 |
+
|
261 |
+
# if dataset == "-any-":
|
262 |
+
# st.info(
|
263 |
+
# "Note: you haven't chosen a dataset, so the leaderboard is showing the best scoring model for a random sample of the datasets available."
|
264 |
+
# )
|
265 |
+
|
266 |
+
# # Make the default metric appear right after model names and dataset names
|
267 |
+
# cols = dataset_df.columns.tolist()
|
268 |
+
# cols.remove(sorting_metric)
|
269 |
+
# sorting_metric_index = 1 if dataset != "-any-" else 2
|
270 |
+
# cols = cols[:sorting_metric_index] + [sorting_metric] + cols[sorting_metric_index:]
|
271 |
+
# dataset_df = dataset_df[cols]
|
272 |
+
|
273 |
+
# # Sort the leaderboard, giving the sorting metric highest priority and then ordering by other metrics in the case of equal values.
|
274 |
+
# dataset_df = dataset_df.sort_values(by=cols[sorting_metric_index:], ascending=[metric in ascending_metrics for metric in cols[sorting_metric_index:]])
|
275 |
+
# dataset_df = dataset_df.replace(np.nan, '-')
|
276 |
+
|
277 |
+
# # If dataset is "-any-", only show the best model for a random sample of 100 datasets.
|
278 |
+
# # Otherwise The leaderboard is way too long and doesn't give the users a feel for all of
|
279 |
+
# # the datasets available for a task.
|
280 |
+
# if dataset == "-any-":
|
281 |
+
# filtered_dataset_df_dict = {column: [] for column in dataset_df.columns}
|
282 |
+
# seen_datasets = set()
|
283 |
+
# for _, row in dataset_df.iterrows():
|
284 |
+
# if row["dataset"] not in seen_datasets:
|
285 |
+
# for column in dataset_df.columns:
|
286 |
+
# filtered_dataset_df_dict[column].append(row[column])
|
287 |
+
# seen_datasets.add(row["dataset"])
|
288 |
+
# dataset_df = pd.DataFrame(filtered_dataset_df_dict)
|
289 |
+
# dataset_df = dataset_df.sample(min(100, len(dataset_df)))
|
290 |
+
|
291 |
+
# # Make the leaderboard
|
292 |
+
# gb = GridOptionsBuilder.from_dataframe(dataset_df)
|
293 |
+
# gb.configure_default_column(sortable=False)
|
294 |
+
# gb.configure_column(
|
295 |
+
# "model_id",
|
296 |
+
# cellRenderer=JsCode('''function(params) {return '<a target="_blank" href="https://huggingface.co/'+params.value+'">'+params.value+'</a>'}'''),
|
297 |
+
# )
|
298 |
+
# if dataset == "-any-":
|
299 |
+
# gb.configure_column(
|
300 |
+
# "dataset",
|
301 |
+
# cellRenderer=JsCode('''function(params) {return '<a target="_blank" href="https://huggingface.co/spaces/autoevaluate/leaderboards?dataset='+params.value+'">'+params.value+'</a>'}'''),
|
302 |
+
# )
|
303 |
+
# for name in selectable_metrics:
|
304 |
+
# gb.configure_column(name, type=["numericColumn","numberColumnFilter","customNumericFormat"], precision=4, aggFunc='sum')
|
305 |
+
|
306 |
+
# gb.configure_column(
|
307 |
+
# sorting_metric,
|
308 |
+
# sortable=True,
|
309 |
+
# cellStyle=JsCode('''function(params) { return {'backgroundColor': '#FFD21E'}}''')
|
310 |
+
# )
|
311 |
+
|
312 |
+
# go = gb.build()
|
313 |
+
# fit_columns = len(dataset_df.columns) < 10
|
314 |
+
# AgGrid(dataset_df, gridOptions=go, height=28*len(dataset_df) + (35 if fit_columns else 41), allow_unsafe_jscode=True, fit_columns_on_grid_load=fit_columns, enable_enterprise_modules=False)
|
315 |
+
|
316 |
+
# else:
|
317 |
+
# st.markdown(
|
318 |
+
# "No " + ("verified" if only_verified_results else "unverified") + " results to display. Try toggling the verified results filter."
|
319 |
+
# )
|