Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 6 additions & 0 deletions ads/aqua/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def create(
compartment_id: Optional[str] = None,
freeform_tags: Optional[Dict] = None,
defined_tags: Optional[Dict] = None,
display_name: Optional[str] = None,
Copy link
Member

Choose a reason for hiding this comment

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

Why this change is here?

**kwargs,
) -> DataScienceModel:
"""
Expand All @@ -169,6 +170,8 @@ def create(
Freeform tags for the model.
defined_tags : Optional[Dict]
Defined tags for the model.
display_name: ptional[str]
The display name of the custom model.

Returns
-------
Expand Down Expand Up @@ -204,6 +207,9 @@ def create(
**(defined_tags or {}),
}

if display_name:
service_model.display_name = display_name

custom_model = (
DataScienceModel()
.with_compartment_id(target_compartment)
Expand Down
15 changes: 12 additions & 3 deletions ads/aqua/modeldeployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def create(
)
aqua_model = model_app.create(
model_id=create_deployment_details.model_id,
display_name=create_deployment_details.model_name,
Copy link
Member

Choose a reason for hiding this comment

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

I think we did not add model name intentionally to avoid leaking user input model names, instead relied on the config information to get the model family. Can you clarify what is sent via UI here?

compartment_id=compartment_id,
project_id=project_id,
freeform_tags=freeform_tags,
Expand Down Expand Up @@ -446,6 +447,7 @@ def _create(
cmd_var_string = aqua_model.custom_metadata_list.get(
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME
).value

default_cmd_var = shlex.split(cmd_var_string)
if default_cmd_var:
cmd_var = validate_cmd_var(default_cmd_var, cmd_var)
Expand Down Expand Up @@ -538,7 +540,6 @@ def _create(
)

deployment_params = get_combined_params(config_params, user_params)

params = f"{params} {deployment_params}".strip()
if params:
env_var.update({"PARAMS": params})
Expand All @@ -560,6 +561,8 @@ def _create(
AQUA_MODEL_TYPE_CUSTOM if is_fine_tuned_model else AQUA_MODEL_TYPE_SERVICE
)

is_custom_base_model = Tags.BASE_MODEL_CUSTOM in aqua_model.freeform_tags

return self._create_deployment(
create_deployment_details=create_deployment_details,
aqua_model_id=aqua_model.id,
Expand All @@ -571,6 +574,7 @@ def _create(
env_var=env_var,
tags=tags,
cmd_var=cmd_var,
is_custom_base_model=is_custom_base_model,
)

def _create_multi(
Expand Down Expand Up @@ -647,6 +651,7 @@ def _create_multi(
}

model_name = f"{MODEL_NAME_DELIMITER} ".join(model_name_list)
is_custom_base_model = Tags.BASE_MODEL_CUSTOM in aqua_model.freeform_tags

aqua_deployment = self._create_deployment(
create_deployment_details=create_deployment_details,
Expand All @@ -658,6 +663,7 @@ def _create_multi(
health_check_port=health_check_port,
env_var=env_var,
tags=tags,
is_custom_base_model=is_custom_base_model,
)
aqua_deployment.models = create_deployment_details.models
return aqua_deployment
Expand All @@ -673,6 +679,7 @@ def _create_deployment(
health_check_port: str,
env_var: dict,
tags: dict,
is_custom_base_model: bool = False,
cmd_var: Optional[dict] = None,
):
"""Creates data science model deployment.
Expand All @@ -698,6 +705,8 @@ def _create_deployment(
The environment variables input for the deployment.
tags: dict
The tags input for the deployment.
is_custom_base_model: bool, optional
The flag set true for custom model.
cmd_var: dict, optional
The cmd arguments input for the deployment.

Expand Down Expand Up @@ -785,8 +794,8 @@ def _create_deployment(
# we arbitrarily choose last 8 characters of OCID to identify MD in telemetry
telemetry_kwargs = {"ocid": get_ocid_substring(deployment_id, key_len=8)}

if Tags.BASE_MODEL_CUSTOM in tags:
telemetry_kwargs["custom_base_model"] = True
if is_custom_base_model:
Copy link
Member

Choose a reason for hiding this comment

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

can you add some details in the description why this approach is needs vs. what we already had?

telemetry_kwargs["custom_base_model"] = "True"

# tracks unique deployments that were created in the user compartment
self.telemetry.record_event_async(
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
Loading