1212from pathlib import Path
1313from typing import Any , Callable , Dict , Optional , Union
1414
15- from azure .core .credentials import TokenCredential
1615from azure .ai .ml ._restclient .v2020_09_01_dataplanepreview .models import DataVersion , UriFileJobOutput
1716from azure .ai .ml ._utils ._arm_id_utils import is_ARM_id_for_resource , is_registry_id_for_resource
1817from azure .ai .ml ._utils ._logger_utils import initialize_logger_info
2322from azure .ai .ml .entities ._deployment .model_batch_deployment import ModelBatchDeployment
2423from azure .ai .ml .exceptions import ErrorCategory , ErrorTarget , MlException , ValidationErrorType , ValidationException
2524from azure .ai .ml .operations ._operation_orchestrator import OperationOrchestrator
25+ from azure .core .credentials import TokenCredential
2626from azure .core .exceptions import (
2727 ClientAuthenticationError ,
2828 HttpResponseError ,
@@ -51,9 +51,10 @@ def check_default_deployment_template(deployment: Deployment, credential: Option
5151
5252 try :
5353 import re
54+
55+ from azure .ai .ml ._utils ._registry_utils import get_registry_client
5456 from azure .ai .ml .constants ._common import REGISTRY_VERSION_PATTERN
5557 from azure .ai .ml .entities ._assets ._artifacts .model import Model
56- from azure .ai .ml ._utils ._registry_utils import get_registry_client
5758
5859 match = re .match (REGISTRY_VERSION_PATTERN , deployment .model , re .IGNORECASE )
5960 if not match :
@@ -78,7 +79,11 @@ def check_default_deployment_template(deployment: Deployment, credential: Option
7879
7980 model = Model ._from_rest_object (model_version_data )
8081
81- if hasattr (model , "default_deployment_template" ) and model .default_deployment_template :
82+ if (
83+ hasattr (model , "default_deployment_template" )
84+ and model .default_deployment_template
85+ and model .default_deployment_template .asset_id
86+ ):
8287 module_logger .info (
8388 "\n Model '%s' (version %s) from registry '%s' has a "
8489 "default deployment template configured.\n "
0 commit comments