1414
1515from ads .aqua import ODSC_MODEL_COMPARTMENT_OCID , logger
1616from ads .aqua .app import AquaApp
17- from ads .aqua .common .enums import Tags
17+ from ads .aqua .common .enums import InferenceContainerTypeFamily , Tags
1818from ads .aqua .common .errors import AquaRuntimeError , AquaValueError
1919from ads .aqua .common .utils import (
2020 LifecycleStatus ,
2121 _build_resource_identifier ,
2222 copy_model_config ,
2323 create_word_icon ,
24+ generate_tei_cmd_vars ,
2425 get_artifact_path ,
2526 get_hf_model_info ,
2627 list_os_files_with_extension ,
6768from ads .common .oci_resource import SEARCH_TYPE , OCIResource
6869from ads .common .utils import get_console_link
6970from ads .config import (
71+ AQUA_DEPLOYMENT_CONTAINER_CMD_VAR ,
7072 AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME ,
73+ AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME ,
7174 AQUA_EVALUATION_CONTAINER_METADATA_NAME ,
7275 AQUA_FINETUNING_CONTAINER_METADATA_NAME ,
7376 COMPARTMENT_OCID ,
@@ -629,6 +632,7 @@ def _create_model_catalog_entry(
629632 validation_result : ModelValidationResult ,
630633 compartment_id : Optional [str ],
631634 project_id : Optional [str ],
635+ inference_container_uri : Optional [str ],
632636 ) -> DataScienceModel :
633637 """Create model by reference from the object storage path
634638
@@ -640,6 +644,7 @@ def _create_model_catalog_entry(
640644 verified_model (DataScienceModel): If set, then copies all the tags and custom metadata information from the service verified model
641645 compartment_id (Optional[str]): Compartment Id of the compartment where the model has to be created
642646 project_id (Optional[str]): Project id of the project where the model has to be created
647+ inference_container_uri (Optional[str]): Inference container uri for BYOC
643648
644649 Returns:
645650 DataScienceModel: Returns Datascience model instance.
@@ -685,6 +690,36 @@ def _create_model_catalog_entry(
685690 raise AquaRuntimeError (
686691 f"Require Inference container information. Model: { model_name } does not have associated inference container defaults. Check docs for more information on how to pass inference container."
687692 )
693+ metadata .add (
694+ key = AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME ,
695+ value = inference_container ,
696+ description = f"Inference container mapping for { model_name } " ,
697+ category = "Other" ,
698+ )
699+ if (
700+ inference_container
701+ == InferenceContainerTypeFamily .AQUA_TEI_CONTAINER_FAMILY
702+ ):
703+ if not inference_container_uri :
704+ logger .warn (
705+ f"Proceeding with model registration without the inference container URI for "
706+ f"{ inference_container } . You can still add this configuration during model deployment."
707+ )
708+ else :
709+ metadata .add (
710+ key = AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME ,
711+ value = inference_container_uri ,
712+ description = f"Inference container URI for { model_name } " ,
713+ category = "Other" ,
714+ )
715+
716+ cmd_vars = generate_tei_cmd_vars (os_path )
717+ metadata .add (
718+ key = AQUA_DEPLOYMENT_CONTAINER_CMD_VAR ,
719+ value = "," .join (cmd_vars ),
720+ description = f"Inference container cmd vars for { model_name } " ,
721+ category = "Other" ,
722+ )
688723 if finetuning_container :
689724 tags [Tags .READY_TO_FINE_TUNE ] = "true"
690725 metadata .add (
@@ -706,12 +741,6 @@ def _create_model_catalog_entry(
706741 category = "Other" ,
707742 )
708743
709- metadata .add (
710- key = AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME ,
711- value = inference_container ,
712- description = f"Inference container mapping for { model_name } " ,
713- category = "Other" ,
714- )
715744 metadata .add (
716745 key = AQUA_EVALUATION_CONTAINER_METADATA_NAME ,
717746 value = "odsc-llm-evaluate" ,
@@ -1012,7 +1041,10 @@ def _validate_model(
10121041 AQUA_MODEL_TYPE_CUSTOM
10131042 )
10141043 elif model_format == ModelFormat .GGUF and len (gguf_model_files ) > 0 :
1015- if import_model_details .finetuning_container and not safetensors_model_files :
1044+ if (
1045+ import_model_details .finetuning_container
1046+ and not safetensors_model_files
1047+ ):
10161048 raise AquaValueError (
10171049 "Fine-tuning is currently not supported with GGUF model format."
10181050 )
@@ -1193,6 +1225,7 @@ def register(
11931225 validation_result = validation_result ,
11941226 compartment_id = import_model_details .compartment_id ,
11951227 project_id = import_model_details .project_id ,
1228+ inference_container_uri = import_model_details .inference_container_uri ,
11961229 )
11971230 # registered model will always have inference and evaluation container, but
11981231 # fine-tuning container may be not set
0 commit comments