Spaces:
Sleeping
Sleeping
Clémentine
commited on
Commit
•
ff8b19d
1
Parent(s):
f20e4c0
fix
Browse files- app.py +3 -8
- src/leaderboard/read_evals.py +0 -5
- src/populate.py +0 -1
app.py
CHANGED
@@ -27,7 +27,7 @@ from src.display.utils import (
|
|
27 |
WeightType,
|
28 |
Precision
|
29 |
)
|
30 |
-
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO
|
31 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
32 |
from src.submission.submit import add_new_eval
|
33 |
|
@@ -41,22 +41,17 @@ def launch_backend():
|
|
41 |
_ = subprocess.run(["python", "main_backend.py"])
|
42 |
|
43 |
try:
|
44 |
-
print(QUEUE_REPO, "to", EVAL_REQUESTS_PATH)
|
45 |
snapshot_download(
|
46 |
-
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30
|
47 |
)
|
48 |
-
print(listdir(EVAL_REQUESTS_PATH))
|
49 |
except Exception as e:
|
50 |
-
print(e)
|
51 |
restart_space()
|
52 |
try:
|
53 |
-
print(RESULTS_REPO, "to", EVAL_RESULTS_PATH)
|
54 |
snapshot_download(
|
55 |
-
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30
|
56 |
)
|
57 |
print(listdir(EVAL_RESULTS_PATH))
|
58 |
except Exception:
|
59 |
-
print(e)
|
60 |
restart_space()
|
61 |
|
62 |
|
|
|
27 |
WeightType,
|
28 |
Precision
|
29 |
)
|
30 |
+
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
31 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
32 |
from src.submission.submit import add_new_eval
|
33 |
|
|
|
41 |
_ = subprocess.run(["python", "main_backend.py"])
|
42 |
|
43 |
try:
|
|
|
44 |
snapshot_download(
|
45 |
+
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
46 |
)
|
|
|
47 |
except Exception as e:
|
|
|
48 |
restart_space()
|
49 |
try:
|
|
|
50 |
snapshot_download(
|
51 |
+
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
52 |
)
|
53 |
print(listdir(EVAL_RESULTS_PATH))
|
54 |
except Exception:
|
|
|
55 |
restart_space()
|
56 |
|
57 |
|
src/leaderboard/read_evals.py
CHANGED
@@ -156,13 +156,10 @@ def get_request_file_for_model(requests_path, model_name, precision):
|
|
156 |
def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResult]:
|
157 |
"""From the path of the results folder root, extract all needed info for results"""
|
158 |
model_result_filepaths = []
|
159 |
-
print("walk", results_path, [i for i in os.walk(results_path)])
|
160 |
|
161 |
for root, _, files in os.walk(results_path):
|
162 |
-
print(root, files)
|
163 |
# We should only have json files in model results
|
164 |
if len(files) == 0 or any([not f.endswith(".json") for f in files]):
|
165 |
-
print("Skipping")
|
166 |
continue
|
167 |
|
168 |
# Sort the files by date
|
@@ -173,7 +170,6 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
173 |
|
174 |
for file in files:
|
175 |
model_result_filepaths.append(os.path.join(root, file))
|
176 |
-
print(model_result_filepaths)
|
177 |
|
178 |
eval_results = {}
|
179 |
for model_result_filepath in model_result_filepaths:
|
@@ -187,7 +183,6 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
187 |
eval_results[eval_name].results.update({k: v for k, v in eval_result.results.items() if v is not None})
|
188 |
else:
|
189 |
eval_results[eval_name] = eval_result
|
190 |
-
print(eval_results)
|
191 |
|
192 |
results = []
|
193 |
for v in eval_results.values():
|
|
|
156 |
def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResult]:
|
157 |
"""From the path of the results folder root, extract all needed info for results"""
|
158 |
model_result_filepaths = []
|
|
|
159 |
|
160 |
for root, _, files in os.walk(results_path):
|
|
|
161 |
# We should only have json files in model results
|
162 |
if len(files) == 0 or any([not f.endswith(".json") for f in files]):
|
|
|
163 |
continue
|
164 |
|
165 |
# Sort the files by date
|
|
|
170 |
|
171 |
for file in files:
|
172 |
model_result_filepaths.append(os.path.join(root, file))
|
|
|
173 |
|
174 |
eval_results = {}
|
175 |
for model_result_filepath in model_result_filepaths:
|
|
|
183 |
eval_results[eval_name].results.update({k: v for k, v in eval_result.results.items() if v is not None})
|
184 |
else:
|
185 |
eval_results[eval_name] = eval_result
|
|
|
186 |
|
187 |
results = []
|
188 |
for v in eval_results.values():
|
src/populate.py
CHANGED
@@ -10,7 +10,6 @@ from src.leaderboard.read_evals import get_raw_eval_results
|
|
10 |
|
11 |
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
12 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
13 |
-
print(raw_data)
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
|
16 |
df = pd.DataFrame.from_records(all_data_json)
|
|
|
10 |
|
11 |
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
12 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
|
|
13 |
all_data_json = [v.to_dict() for v in raw_data]
|
14 |
|
15 |
df = pd.DataFrame.from_records(all_data_json)
|