Skip to content

Commit 5b3a316

Browse files
inference container uri validation check
1 parent a95a678 commit 5b3a316

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

ads/aqua/model/model.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -411,20 +411,33 @@ def edit_registered_model(
411411
custom_metadata_list = ds_model.custom_metadata_list
412412
freeform_tags = ds_model.freeform_tags
413413
if inference_container:
414-
custom_metadata_list.add(
415-
key=ModelCustomMetadataFields.DEPLOYMENT_CONTAINER,
416-
value=inference_container,
417-
category=MetadataCustomCategory.OTHER,
418-
description="Deployment container mapping for SMC",
419-
replace=True,
420-
)
414+
if (inference_container==InferenceContainerTypeFamily.AQUA_TEI_CONTAINER_FAMILY
415+
and inference_container_uri is None):
416+
raise AquaRuntimeError(
417+
f"Failed to edit model:{id}. Inference container URI must be provided."
418+
)
419+
else:
420+
custom_metadata_list.add(
421+
key=ModelCustomMetadataFields.DEPLOYMENT_CONTAINER,
422+
value=inference_container,
423+
category=MetadataCustomCategory.OTHER,
424+
description="Deployment container mapping for SMC",
425+
replace=True,
426+
)
421427
if inference_container_uri:
422-
custom_metadata_list.add(
423-
key=ModelCustomMetadataFields.DEPLOYMENT_CONTAINER_URI,
424-
value=inference_container_uri,
425-
category=MetadataCustomCategory.OTHER,
426-
description=f"Inference container URI for {ds_model.display_name}",
427-
)
428+
if inference_container==InferenceContainerTypeFamily.AQUA_TEI_CONTAINER_FAMILY or inference_container==None:
429+
custom_metadata_list.add(
430+
key=ModelCustomMetadataFields.DEPLOYMENT_CONTAINER_URI,
431+
value=inference_container_uri,
432+
category=MetadataCustomCategory.OTHER,
433+
description=f"Inference container URI for {ds_model.display_name}",
434+
replace=True
435+
)
436+
else:
437+
raise AquaRuntimeError(
438+
f"Failed to edit model:{id}. Inference container URI can be edited only with TEI container."
439+
)
440+
428441
if enable_finetuning is not None:
429442
if enable_finetuning.lower() == "true":
430443
custom_metadata_list.add(

0 commit comments

Comments
 (0)