albertvillanova HF staff commited on
Commit
3aab755
1 Parent(s): 0c0a603

Remove special characters from model name for InferenceEndpoint name

Browse files
src/backend/run_eval_suite_lighteval.py CHANGED
@@ -1,6 +1,7 @@
1
  import json
2
  import argparse
3
  import logging
 
4
  from datetime import datetime
5
 
6
  import lighteval
@@ -17,6 +18,10 @@ from src.logging import setup_logger
17
  logging.getLogger("openai").setLevel(logging.WARNING)
18
  logger = setup_logger(__name__)
19
 
 
 
 
 
20
  def run_evaluation(eval_request: EvalRequest, task_names: str, batch_size: int, local_dir: str, accelerator: str, region: str, vendor: str, instance_size: str, instance_type: str, limit=None):
21
  """Runs one evaluation for the current evaluation request file using lighteval, then pushes the results to the hub.
22
 
@@ -57,7 +62,7 @@ def run_evaluation(eval_request: EvalRequest, task_names: str, batch_size: int,
57
 
58
  model_config = InferenceEndpointModelConfig(
59
  # Endpoint parameters
60
- name = eval_request.model.replace(".", "-").lower(),
61
  repository = eval_request.model,
62
  accelerator = accelerator,
63
  vendor= vendor,
 
1
  import json
2
  import argparse
3
  import logging
4
+ import re
5
  from datetime import datetime
6
 
7
  import lighteval
 
18
  logging.getLogger("openai").setLevel(logging.WARNING)
19
  logger = setup_logger(__name__)
20
 
21
+
22
+ SPECIAL_CHARACTERS_PATTERN = re.compile(r"[^a-zA-Z0-9-]")
23
+
24
+
25
  def run_evaluation(eval_request: EvalRequest, task_names: str, batch_size: int, local_dir: str, accelerator: str, region: str, vendor: str, instance_size: str, instance_type: str, limit=None):
26
  """Runs one evaluation for the current evaluation request file using lighteval, then pushes the results to the hub.
27
 
 
62
 
63
  model_config = InferenceEndpointModelConfig(
64
  # Endpoint parameters
65
+ name=SPECIAL_CHARACTERS_PATTERN.sub("-", eval_request.model.lower()),
66
  repository = eval_request.model,
67
  accelerator = accelerator,
68
  vendor= vendor,