@@ -296,33 +296,43 @@ def get_config(self, model_id: str, config_file_name: str) -> Dict:
296
296
raise AquaRuntimeError (f"Target model { oci_model .id } is not Aqua model." )
297
297
298
298
config = {}
299
- artifact_path = get_artifact_path (oci_model .custom_metadata_list )
299
+ # if the current model has a service model tag, then
300
+ if Tags .AQUA_SERVICE_MODEL_TAG in oci_model .freeform_tags :
301
+ base_model_ocid = oci_model .freeform_tags [Tags .AQUA_SERVICE_MODEL_TAG ]
302
+ logger .info (
303
+ f"Base model found for the model: { oci_model .id } . "
304
+ f"Loading { config_file_name } for base model { base_model_ocid } ."
305
+ )
306
+ base_model = self .ds_client .get_model (base_model_ocid ).data
307
+ artifact_path = get_artifact_path (base_model .custom_metadata_list )
308
+ config_path = f"{ os .path .dirname (artifact_path )} /config/"
309
+ else :
310
+ logger .info (f"Loading { config_file_name } for model { oci_model .id } ..." )
311
+ artifact_path = get_artifact_path (oci_model .custom_metadata_list )
312
+ config_path = f"{ artifact_path .rstrip ('/' )} /config/"
313
+
300
314
if not artifact_path :
301
315
logger .debug (
302
316
f"Failed to get artifact path from custom metadata for the model: { model_id } "
303
317
)
304
318
return config
305
319
306
320
try :
307
- config_path = f"{ os .path .dirname (artifact_path )} /config/"
308
321
config = load_config (
309
322
config_path ,
310
323
config_file_name = config_file_name ,
311
324
)
312
325
except Exception :
313
- # todo: temp fix for issue related to config load for byom models, update logic to choose the right path
314
- try :
315
- config_path = f"{ artifact_path .rstrip ('/' )} /config/"
316
- config = load_config (
317
- config_path ,
318
- config_file_name = config_file_name ,
319
- )
320
- except Exception :
321
- pass
326
+ logger .debug (
327
+ f"Error loading the { config_file_name } at path { config_path } ." ,
328
+ exc_info = True ,
329
+ )
330
+ pass
322
331
323
332
if not config :
324
333
logger .error (
325
- f"{ config_file_name } is not available for the model: { model_id } . Check if the custom metadata has the artifact path set."
334
+ f"{ config_file_name } is not available for the model: { model_id } . "
335
+ f"Check if the custom metadata has the artifact path set."
326
336
)
327
337
return config
328
338
0 commit comments