Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
c8ea768
1
Parent(s):
2ce4591
update
Browse files- backend-cli.py +19 -8
backend-cli.py
CHANGED
@@ -33,8 +33,19 @@ FAILED_STATUS = "FAILED"
|
|
33 |
|
34 |
TASKS_HARNESS = [task.value for task in Tasks]
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
|
40 |
def sanity_checks():
|
@@ -42,7 +53,7 @@ def sanity_checks():
|
|
42 |
|
43 |
# pull the eval dataset from the hub and parse any eval requests
|
44 |
# check completed evals and set them to finished
|
45 |
-
|
46 |
check_completed_evals(api=API, checked_status=RUNNING_STATUS, completed_status=FINISHED_STATUS,
|
47 |
failed_status=FAILED_STATUS, hf_repo=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH_BACKEND,
|
48 |
hf_repo_results=RESULTS_REPO, local_dir_results=EVAL_RESULTS_PATH_BACKEND)
|
@@ -86,7 +97,7 @@ def process_evaluation(task: Task, eval_request: EvalRequest) -> dict:
|
|
86 |
with open(output_path, "w") as f:
|
87 |
f.write(dumped)
|
88 |
|
89 |
-
|
90 |
API.upload_file(path_or_fileobj=output_path, path_in_repo=f"{eval_request.model}/results_{datetime.now()}.json",
|
91 |
repo_id=RESULTS_REPO, repo_type="dataset")
|
92 |
return results
|
@@ -130,13 +141,13 @@ def process_finished_requests() -> bool:
|
|
130 |
if eval_result is None or task_name not in eval_result.results:
|
131 |
eval_request: EvalRequest = result_name_to_request[result_name]
|
132 |
|
133 |
-
|
134 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=RUNNING_STATUS, hf_repo=QUEUE_REPO,
|
135 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
136 |
|
137 |
results = process_evaluation(task, eval_request)
|
138 |
|
139 |
-
|
140 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=FINISHED_STATUS, hf_repo=QUEUE_REPO,
|
141 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
142 |
|
@@ -165,7 +176,7 @@ def process_pending_requests() -> bool:
|
|
165 |
eval_request = eval_requests[0]
|
166 |
pp.pprint(eval_request)
|
167 |
|
168 |
-
|
169 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=RUNNING_STATUS, hf_repo=QUEUE_REPO,
|
170 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
171 |
|
@@ -175,7 +186,7 @@ def process_pending_requests() -> bool:
|
|
175 |
for task in task_lst:
|
176 |
results = process_evaluation(task, eval_request)
|
177 |
|
178 |
-
|
179 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=FINISHED_STATUS, hf_repo=QUEUE_REPO,
|
180 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
181 |
|
|
|
33 |
|
34 |
TASKS_HARNESS = [task.value for task in Tasks]
|
35 |
|
36 |
+
|
37 |
+
def my_snapshot_download(repo_id, revision, local_dir, repo_type, max_workers):
|
38 |
+
for i in range(10):
|
39 |
+
try:
|
40 |
+
snapshot_download(repo_id=repo_id, revision=revision, local_dir=local_dir, repo_type=repo_type, max_workers=max_workers)
|
41 |
+
return
|
42 |
+
except Exception:
|
43 |
+
pass
|
44 |
+
return
|
45 |
+
|
46 |
+
|
47 |
+
my_snapshot_download(repo_id=RESULTS_REPO, revision="main", local_dir=EVAL_RESULTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
48 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
49 |
|
50 |
|
51 |
def sanity_checks():
|
|
|
53 |
|
54 |
# pull the eval dataset from the hub and parse any eval requests
|
55 |
# check completed evals and set them to finished
|
56 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
57 |
check_completed_evals(api=API, checked_status=RUNNING_STATUS, completed_status=FINISHED_STATUS,
|
58 |
failed_status=FAILED_STATUS, hf_repo=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH_BACKEND,
|
59 |
hf_repo_results=RESULTS_REPO, local_dir_results=EVAL_RESULTS_PATH_BACKEND)
|
|
|
97 |
with open(output_path, "w") as f:
|
98 |
f.write(dumped)
|
99 |
|
100 |
+
my_snapshot_download(repo_id=RESULTS_REPO, revision="main", local_dir=EVAL_RESULTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
101 |
API.upload_file(path_or_fileobj=output_path, path_in_repo=f"{eval_request.model}/results_{datetime.now()}.json",
|
102 |
repo_id=RESULTS_REPO, repo_type="dataset")
|
103 |
return results
|
|
|
141 |
if eval_result is None or task_name not in eval_result.results:
|
142 |
eval_request: EvalRequest = result_name_to_request[result_name]
|
143 |
|
144 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
145 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=RUNNING_STATUS, hf_repo=QUEUE_REPO,
|
146 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
147 |
|
148 |
results = process_evaluation(task, eval_request)
|
149 |
|
150 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
151 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=FINISHED_STATUS, hf_repo=QUEUE_REPO,
|
152 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
153 |
|
|
|
176 |
eval_request = eval_requests[0]
|
177 |
pp.pprint(eval_request)
|
178 |
|
179 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
180 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=RUNNING_STATUS, hf_repo=QUEUE_REPO,
|
181 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
182 |
|
|
|
186 |
for task in task_lst:
|
187 |
results = process_evaluation(task, eval_request)
|
188 |
|
189 |
+
my_snapshot_download(repo_id=QUEUE_REPO, revision="main", local_dir=EVAL_REQUESTS_PATH_BACKEND, repo_type="dataset", max_workers=60)
|
190 |
set_eval_request(api=API, eval_request=eval_request, set_to_status=FINISHED_STATUS, hf_repo=QUEUE_REPO,
|
191 |
local_dir=EVAL_REQUESTS_PATH_BACKEND)
|
192 |
|