Spaces:
Sleeping
Sleeping
XufengDuan
commited on
Commit
•
5c401da
1
Parent(s):
2a968dc
update scripts
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ import src.submission.submit as submit
|
|
15 |
import os
|
16 |
TOKEN = os.environ.get("H4_TOKEN", None)
|
17 |
print("TOKEN", TOKEN)
|
|
|
18 |
|
19 |
def ui_snapshot_download(repo_id, local_dir, repo_type, tqdm_class, etag_timeout):
|
20 |
try:
|
@@ -41,6 +42,33 @@ def init_space():
|
|
41 |
original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
42 |
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
# try:
|
45 |
# print(envs.EVAL_REQUESTS_PATH)
|
46 |
# snapshot_download(
|
|
|
15 |
import os
|
16 |
TOKEN = os.environ.get("H4_TOKEN", None)
|
17 |
print("TOKEN", TOKEN)
|
18 |
+
import src.backend.run_eval_suite as run_eval_suite
|
19 |
|
20 |
def ui_snapshot_download(repo_id, local_dir, repo_type, tqdm_class, etag_timeout):
|
21 |
try:
|
|
|
42 |
original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
43 |
|
44 |
|
45 |
+
def process_pending_evals():
|
46 |
+
if len(pending_eval_queue_df) == 0:
|
47 |
+
print("No pending evaluations found.")
|
48 |
+
return
|
49 |
+
|
50 |
+
for _, eval_request in pending_eval_queue_df.iterrows():
|
51 |
+
# 根据具体的列名和数据格式调整 `eval_request` 的内容
|
52 |
+
print(f"Evaluating model: {eval_request['model']}")
|
53 |
+
|
54 |
+
# 调用评估函数
|
55 |
+
run_eval_suite.run_evaluation(
|
56 |
+
eval_request=eval_request,
|
57 |
+
local_dir=envs.EVAL_RESULTS_PATH_BACKEND,
|
58 |
+
results_repo=envs.RESULTS_REPO,
|
59 |
+
batch_size=1,
|
60 |
+
device=envs.DEVICE,
|
61 |
+
no_cache=True,
|
62 |
+
need_check=True, # 根据需要设定是否需要检查
|
63 |
+
write_results=True # 根据需要设定是否写入结果
|
64 |
+
)
|
65 |
+
print(f"Finished evaluation for model: {eval_request['model']}")
|
66 |
+
|
67 |
+
|
68 |
+
# 在初始化完成后调用
|
69 |
+
original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
70 |
+
process_pending_evals()
|
71 |
+
|
72 |
# try:
|
73 |
# print(envs.EVAL_REQUESTS_PATH)
|
74 |
# snapshot_download(
|