Skip to content

Commit

Permalink
Fix ignored reuse_existing in config file (#431)
Browse files Browse the repository at this point in the history
* Align should_reuse_existing with reuse_existing

* Align reuse_existing default to False
  • Loading branch information
albertvillanova authored Dec 10, 2024
1 parent 075a266 commit f2e1f69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lighteval/main_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def inference_endpoint(
"endpoint_name": config["base_params"].get("endpoint_name", None),
"model_dtype": config["base_params"].get("dtype", None),
"revision": config["base_params"].get("revision", None) or "main",
"should_reuse_existing": config["base_params"].get("should_reuse_existing"),
"reuse_existing": config["base_params"].get("reuse_existing"),
"accelerator": config.get("instance", {}).get("accelerator", None),
"region": config.get("instance", {}).get("region", None),
"vendor": config.get("instance", {}).get("vendor", None),
Expand Down
8 changes: 4 additions & 4 deletions src/lighteval/models/endpoints/endpoint_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class InferenceModelConfig:
class InferenceEndpointModelConfig:
endpoint_name: str = None
model_name: str = None
should_reuse_existing: bool = False
reuse_existing: bool = False
accelerator: str = "gpu"
model_dtype: str = None # if empty, we use the default
vendor: str = "aws"
Expand Down Expand Up @@ -135,7 +135,7 @@ class InferenceEndpointModel(LightevalModel):
def __init__( # noqa: C901
self, config: Union[InferenceEndpointModelConfig, InferenceModelConfig], env_config: EnvConfig
) -> None:
self.reuse_existing = getattr(config, "should_reuse_existing", True)
self.reuse_existing = getattr(config, "reuse_existing", False)
self._max_length = None
self.endpoint = None
self.model_name = None
Expand Down Expand Up @@ -171,7 +171,7 @@ def __init__( # noqa: C901
):
try:
if self.endpoint is None: # Endpoint does not exist yet locally
if not config.should_reuse_existing: # New endpoint
if not config.reuse_existing: # New endpoint
logger.info("Creating endpoint.")
self.endpoint: InferenceEndpoint = create_inference_endpoint(
name=endpoint_name,
Expand Down Expand Up @@ -239,7 +239,7 @@ def __init__( # noqa: C901
# The endpoint actually already exists, we'll spin it up instead of trying to create a new one
if "409 Client Error: Conflict for url:" in str(e):
config.endpoint_name = endpoint_name
config.should_reuse_existing = True
config.reuse_existing = True
# Requested resources are not available
elif "Bad Request: Compute instance not available yet" in str(e):
logger.error(
Expand Down

0 comments on commit f2e1f69

Please sign in to comment.