Spaces:
Paused
Paused
Added timeout redundancy, fixed naming for underscores
Browse files
src/backend/run_eval_suite_lighteval.py
CHANGED
@@ -9,6 +9,7 @@ from src.envs import RESULTS_REPO, CACHE_PATH, TOKEN, OWNER
|
|
9 |
from src.backend.manage_requests import EvalRequest
|
10 |
from lighteval.logging.evaluation_tracker import EnhancedJSONEncoder
|
11 |
from lighteval.models.model_loader import ModelInfo
|
|
|
12 |
|
13 |
logging.getLogger("openai").setLevel(logging.WARNING)
|
14 |
|
@@ -24,7 +25,7 @@ def run_evaluation(eval_request: EvalRequest, task_names: str, batch_size: int,
|
|
24 |
"model_config": dict(model=dict(
|
25 |
type="endpoint",
|
26 |
base_params=dict(
|
27 |
-
endpoint_name=f'{eval_request.model.split("/")[1].replace(".", "-").lower()}-lighteval'[-32:].strip('-'),
|
28 |
model=eval_request.model,
|
29 |
revision=eval_request.revision,
|
30 |
dtype=eval_request.precision,
|
@@ -61,7 +62,16 @@ def run_evaluation(eval_request: EvalRequest, task_names: str, batch_size: int,
|
|
61 |
})
|
62 |
|
63 |
try:
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
dumped = json.dumps(results, cls=EnhancedJSONEncoder, indent=2)
|
67 |
print(dumped)
|
|
|
9 |
from src.backend.manage_requests import EvalRequest
|
10 |
from lighteval.logging.evaluation_tracker import EnhancedJSONEncoder
|
11 |
from lighteval.models.model_loader import ModelInfo
|
12 |
+
from huggingface_hub.errors import InferenceEndpointTimeoutError
|
13 |
|
14 |
logging.getLogger("openai").setLevel(logging.WARNING)
|
15 |
|
|
|
25 |
"model_config": dict(model=dict(
|
26 |
type="endpoint",
|
27 |
base_params=dict(
|
28 |
+
endpoint_name=f'{eval_request.model.split("/")[1].replace(".", "-").replace('_', '-').lower()}-lighteval'[-32:].strip('-'),
|
29 |
model=eval_request.model,
|
30 |
revision=eval_request.revision,
|
31 |
dtype=eval_request.precision,
|
|
|
62 |
})
|
63 |
|
64 |
try:
|
65 |
+
# in case of timeout, try it again with reuse_existing
|
66 |
+
for i in range(3):
|
67 |
+
try:
|
68 |
+
results = main(args)
|
69 |
+
# if we are i>0, then raise an error so that we call clean up
|
70 |
+
if i > 0: raise Exception()
|
71 |
+
except InferenceEndpointTimeoutError:
|
72 |
+
if i < 3:
|
73 |
+
print('Timed out, trying again...')
|
74 |
+
args.model_config['model']['base_params']['reuse_existing'] = True
|
75 |
|
76 |
dumped = json.dumps(results, cls=EnhancedJSONEncoder, indent=2)
|
77 |
print(dumped)
|