7
7
import re
8
8
import tempfile
9
9
from concurrent .futures import ThreadPoolExecutor , as_completed
10
- from dataclasses import asdict
10
+ from dataclasses import asdict , fields
11
11
from datetime import datetime , timedelta
12
12
from pathlib import Path
13
13
from threading import Lock
@@ -160,8 +160,9 @@ def create(
160
160
create_aqua_evaluation_details = CreateAquaEvaluationDetails (** kwargs )
161
161
except Exception as ex :
162
162
raise AquaValueError (
163
- "Invalid create evaluation parameters. Allowable parameters are: "
164
- f"{ ', ' .join (list (asdict (CreateAquaEvaluationDetails ).keys ()))} ."
163
+ "Invalid create evaluation parameters. "
164
+ "Allowable parameters are: "
165
+ f"{ ', ' .join ([field .name for field in fields (CreateAquaEvaluationDetails )])} ."
165
166
) from ex
166
167
167
168
if not is_valid_ocid (create_aqua_evaluation_details .evaluation_source_id ):
@@ -178,18 +179,28 @@ def create(
178
179
evaluation_source = ModelDeployment .from_id (
179
180
create_aqua_evaluation_details .evaluation_source_id
180
181
)
181
- if evaluation_source .runtime .type == ModelDeploymentRuntimeType .CONTAINER :
182
- runtime = ModelDeploymentContainerRuntime .from_dict (
183
- evaluation_source .runtime .to_dict ()
182
+ try :
183
+ if (
184
+ evaluation_source .runtime .type
185
+ == ModelDeploymentRuntimeType .CONTAINER
186
+ ):
187
+ runtime = ModelDeploymentContainerRuntime .from_dict (
188
+ evaluation_source .runtime .to_dict ()
189
+ )
190
+ inference_config = AquaContainerConfig .from_container_index_json (
191
+ enable_spec = True
192
+ ).inference
193
+ for container in inference_config .values ():
194
+ if container .name == runtime .image .split (":" )[0 ]:
195
+ eval_inference_configuration = (
196
+ container .spec .evaluation_configuration
197
+ )
198
+ except Exception :
199
+ logger .debug (
200
+ f"Could not load inference config details for the evaluation id: "
201
+ f"{ create_aqua_evaluation_details .evaluation_source_id } . Please check if the container"
202
+ f" runtime has the correct SMC image information."
184
203
)
185
- inference_config = AquaContainerConfig .from_container_index_json (
186
- enable_spec = True
187
- ).inference
188
- for container in inference_config .values ():
189
- if container .name == runtime .image .split (":" )[0 ]:
190
- eval_inference_configuration = (
191
- container .spec .evaluation_configuration
192
- )
193
204
elif (
194
205
DataScienceResource .MODEL
195
206
in create_aqua_evaluation_details .evaluation_source_id
@@ -550,7 +561,7 @@ def _build_evaluation_runtime(
550
561
metrics = metrics ,
551
562
),
552
563
),
553
- ** inference_configuration ,
564
+ ** ( inference_configuration or {}) ,
554
565
},
555
566
),
556
567
"CONDA_BUCKET_NS" : CONDA_BUCKET_NS ,
0 commit comments