Spaces:
Runtime error
Runtime error
Commit
•
b3198c3
1
Parent(s):
abbdf73
update
Browse files- app.py +3 -1
- src/backend/manage_requests.py +4 -16
app.py
CHANGED
@@ -373,7 +373,9 @@ scheduler.add_job(restart_space, "interval", seconds=2 * 60 * 60)
|
|
373 |
|
374 |
def launch_backend():
|
375 |
import subprocess
|
376 |
-
|
|
|
|
|
377 |
|
378 |
|
379 |
scheduler.add_job(launch_backend, "interval", seconds=120)
|
|
|
373 |
|
374 |
def launch_backend():
|
375 |
import subprocess
|
376 |
+
from src.backend.envs import DEVICE
|
377 |
+
if DEVICE not in {'cpu'}:
|
378 |
+
_ = subprocess.run(["python", "backend-cli.py"])
|
379 |
|
380 |
|
381 |
scheduler.add_job(launch_backend, "interval", seconds=120)
|
src/backend/manage_requests.py
CHANGED
@@ -90,16 +90,8 @@ def get_eval_requests(job_status: list, local_dir: str, hf_repo: str) -> list[Ev
|
|
90 |
return eval_requests
|
91 |
|
92 |
|
93 |
-
def check_completed_evals(
|
94 |
-
|
95 |
-
hf_repo: str,
|
96 |
-
local_dir: str,
|
97 |
-
checked_status: str,
|
98 |
-
completed_status: str,
|
99 |
-
failed_status: str,
|
100 |
-
hf_repo_results: str,
|
101 |
-
local_dir_results: str,
|
102 |
-
):
|
103 |
"""Checks if the currently running evals are completed, if yes, update their status on the hub."""
|
104 |
snapshot_download(repo_id=hf_repo_results, revision="main", local_dir=local_dir_results, repo_type="dataset", max_workers=60)
|
105 |
|
@@ -115,12 +107,8 @@ def check_completed_evals(
|
|
115 |
output_file_exists = len(glob.glob(output_file)) > 0
|
116 |
|
117 |
if output_file_exists:
|
118 |
-
print(
|
119 |
-
f"EXISTS output file exists for {model} setting it to {completed_status}"
|
120 |
-
)
|
121 |
set_eval_request(api, eval_request, completed_status, hf_repo, local_dir)
|
122 |
else:
|
123 |
-
print(
|
124 |
-
f"No result file found for {model} setting it to {failed_status}"
|
125 |
-
)
|
126 |
set_eval_request(api, eval_request, failed_status, hf_repo, local_dir)
|
|
|
90 |
return eval_requests
|
91 |
|
92 |
|
93 |
+
def check_completed_evals(api: HfApi, hf_repo: str, local_dir: str, checked_status: str, completed_status: str,
|
94 |
+
failed_status: str, hf_repo_results: str, local_dir_results: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
"""Checks if the currently running evals are completed, if yes, update their status on the hub."""
|
96 |
snapshot_download(repo_id=hf_repo_results, revision="main", local_dir=local_dir_results, repo_type="dataset", max_workers=60)
|
97 |
|
|
|
107 |
output_file_exists = len(glob.glob(output_file)) > 0
|
108 |
|
109 |
if output_file_exists:
|
110 |
+
print(f"EXISTS output file exists for {model} setting it to {completed_status}")
|
|
|
|
|
111 |
set_eval_request(api, eval_request, completed_status, hf_repo, local_dir)
|
112 |
else:
|
113 |
+
print(f"No result file found for {model} setting it to {failed_status}")
|
|
|
|
|
114 |
set_eval_request(api, eval_request, failed_status, hf_repo, local_dir)
|