Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Apply formatters to src/populate.py
Browse files- src/populate.py +15 -12
src/populate.py
CHANGED
@@ -13,29 +13,32 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
13 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
|
16 |
-
|
17 |
-
|
18 |
df = pd.DataFrame.from_records(all_data_json)
|
19 |
-
|
20 |
score_cols = [
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
]
|
24 |
-
|
25 |
existing_score_cols = [col for col in score_cols if col in df.columns]
|
26 |
-
|
27 |
# γΉγ³γ’εγ100γ§ε²γγ.4fε½’εΌγ§γγ©γΌγγγ
|
28 |
-
df[existing_score_cols] = (df[existing_score_cols] / 100).applymap(lambda x: f
|
29 |
df = df.sort_values(by=[AutoEvalColumn.AVG.name], ascending=False)
|
30 |
df = df[cols].round(decimals=2)
|
31 |
-
|
32 |
# filter out if any of the benchmarks have not been produced
|
33 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
34 |
|
35 |
-
df[
|
36 |
-
|
37 |
-
return df
|
38 |
|
|
|
39 |
|
40 |
|
41 |
def get_evaluation_queue_df(save_path: str, cols: list) -> list[pd.DataFrame]:
|
|
|
13 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
|
|
|
|
|
16 |
df = pd.DataFrame.from_records(all_data_json)
|
17 |
+
|
18 |
score_cols = [
|
19 |
+
"ALT E to J BLEU",
|
20 |
+
"ALT J to E BLEU",
|
21 |
+
"WikiCorpus E to J BLEU",
|
22 |
+
"WikiCorpus J to E BLEU",
|
23 |
+
"XL-Sum JA BLEU",
|
24 |
+
"XL-Sum ROUGE1",
|
25 |
+
"XL-Sum ROUGE2",
|
26 |
+
"XL-Sum ROUGE-Lsum",
|
27 |
]
|
28 |
+
|
29 |
existing_score_cols = [col for col in score_cols if col in df.columns]
|
30 |
+
|
31 |
# γΉγ³γ’εγ100γ§ε²γγ.4fε½’εΌγ§γγ©γΌγγγ
|
32 |
+
df[existing_score_cols] = (df[existing_score_cols] / 100).applymap(lambda x: f"{x:.4f}")
|
33 |
df = df.sort_values(by=[AutoEvalColumn.AVG.name], ascending=False)
|
34 |
df = df[cols].round(decimals=2)
|
35 |
+
|
36 |
# filter out if any of the benchmarks have not been produced
|
37 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
38 |
|
39 |
+
df["Model"] = df["Model"].apply(lambda x: f'[{x.split("/")[-1]}]({x})' if isinstance(x, str) else x)
|
|
|
|
|
40 |
|
41 |
+
return df
|
42 |
|
43 |
|
44 |
def get_evaluation_queue_df(save_path: str, cols: list) -> list[pd.DataFrame]:
|