Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions ads/aqua/modeldeployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@
ModelDeploymentConfigSummary,
MultiModelDeploymentConfigLoader,
)
from ads.aqua.modeldeployment.constants import (
DEFAULT_POLL_INTERVAL,
DEFAULT_WAIT_TIME,
)
from ads.aqua.modeldeployment.constants import DEFAULT_POLL_INTERVAL, DEFAULT_WAIT_TIME
from ads.aqua.modeldeployment.entities import (
AquaDeployment,
AquaDeploymentDetail,
Expand Down Expand Up @@ -529,6 +526,7 @@ def _create(

# validate user provided params
user_params = env_var.get("PARAMS", UNKNOWN)

if user_params:
# todo: remove this check in the future version, logic to be moved to container_index
if (
Expand All @@ -554,6 +552,18 @@ def _create(
deployment_params = get_combined_params(config_params, user_params)

params = f"{params} {deployment_params}".strip()

if create_deployment_details.model_name:
# Replace existing --served-model-name argument if present, otherwise add it
if "--served-model-name" in params:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have helper api to update the parameter in params string and you can do something like this

params_dict = get_params_dict(params)
params_dict.update({"--served-model-name": create_deployment_details.model_name})
params = build_params_string(params_dict)

params = re.sub(
r"--served-model-name\s+\S+",
f"--served-model-name {create_deployment_details.model_name}",
params,
)
else:
params += f" --served-model-name {create_deployment_details.model_name}"

if params:
env_var.update({"PARAMS": params})
env_vars = container_spec.env_vars if container_spec else []
Expand Down
3 changes: 3 additions & 0 deletions ads/aqua/modeldeployment/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ class CreateModelDeploymentDetails(BaseModel):
None, description="The description of the deployment."
)
model_id: Optional[str] = Field(None, description="The model OCID to deploy.")
model_name: Optional[str] = Field(
None, description="The model name specified by user to deploy."
)

models: Optional[List[AquaMultiModelRef]] = Field(
None, description="List of models for multimodel deployment."
Expand Down
9 changes: 5 additions & 4 deletions tests/unitary/with_extras/aqua/test_common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import pytest

from ads.aqua.common.utils import get_preferred_compatible_family


Expand All @@ -14,23 +15,23 @@ class TestCommonUtils:
[
(
{"odsc-vllm-serving", "odsc-vllm-serving-v1"},
"odsc-vllm-serving-v1",
"odsc-vllm-serving-openai",
),
(
{"odsc-vllm-serving", "odsc-vllm-serving-llama4"},
"odsc-vllm-serving-llama4",
"odsc-vllm-serving-openai",
),
(
{"odsc-vllm-serving-v1", "odsc-vllm-serving-llama4"},
"odsc-vllm-serving-llama4",
"odsc-vllm-serving-openai",
),
(
{
"odsc-vllm-serving",
"odsc-vllm-serving-v1",
"odsc-vllm-serving-llama4",
},
"odsc-vllm-serving-llama4",
"odsc-vllm-serving-openai",
),
({"odsc-tgi-serving", "odsc-vllm-serving"}, None),
({"non-existing-one", "odsc-tgi-serving"}, None),
Expand Down
Loading