18
18
from ads .feature_store .common .utils .utility import (
19
19
get_metastore_id ,
20
20
validate_delta_format_parameters ,
21
- convert_expectation_suite_to_expectation ,
22
- validate_model_ocid_format , search_model_ocids
21
+ convert_expectation_suite_to_expectation
23
22
)
24
23
from ads .feature_store .dataset_job import DatasetJob , IngestionMode
25
24
from ads .feature_store .execution_strategy .engine .spark_engine import SparkEngine
@@ -375,7 +374,7 @@ def expectation_details(self) -> "Expectation":
375
374
return self .get_spec (self .CONST_EXPECTATION_DETAILS )
376
375
377
376
def with_expectation_suite (
378
- self , expectation_suite : ExpectationSuite , expectation_type : ExpectationType
377
+ self , expectation_suite : ExpectationSuite , expectation_type : ExpectationType
379
378
) -> "Dataset" :
380
379
"""Sets the expectation details for the feature group.
381
380
@@ -446,7 +445,7 @@ def statistics_config(self, statistics_config: StatisticsConfig):
446
445
self .with_statistics_config (statistics_config )
447
446
448
447
def with_statistics_config (
449
- self , statistics_config : Union [StatisticsConfig , bool ]
448
+ self , statistics_config : Union [StatisticsConfig , bool ]
450
449
) -> "Dataset" :
451
450
"""Sets the statistics details for the dataset.
452
451
@@ -482,7 +481,7 @@ def model_details(self) -> "ModelDetails":
482
481
def model_details (self , model_details : ModelDetails ):
483
482
self .with_model_details (model_details )
484
483
485
- def with_model_details (self , model_details : ModelDetails , validate : bool = True ) -> "Dataset" :
484
+ def with_model_details (self , model_details : ModelDetails ) -> "Dataset" :
486
485
"""Sets the model details for the dataset.
487
486
488
487
Parameters
@@ -500,17 +499,6 @@ def with_model_details(self, model_details: ModelDetails,validate: bool = True)
500
499
"The argument `model_details` has to be of type `ModelDetails`"
501
500
"but is of type: `{}`" .format (type (model_details ))
502
501
)
503
- #TODO: we could eiher use validate_model_ocid_format if thats enough or search_model_ocids
504
- #search_model_ocids should be used after set_auth without url
505
- # items = model_details["items"]
506
- # for item in items:
507
- # if not validate_model_ocid(item):
508
- # raise ValueError(
509
- # f"the model ocid {item} is not valid"
510
- # )
511
- if validate :
512
- model_ids_list = search_model_ocids (model_details .items )
513
- model_details = ModelDetails (model_ids_list )
514
502
515
503
return self .set_spec (self .CONST_MODEL_DETAILS , model_details .to_dict ())
516
504
@@ -532,7 +520,14 @@ def add_models(self, model_details: ModelDetails) -> "Dataset":
532
520
for item in items :
533
521
model_details .items .append (item )
534
522
self .with_model_details (model_details )
535
- return self .update ()
523
+ self .update ()
524
+
525
+ self ._update_from_oci_dataset_model (self .oci_dataset )
526
+ updated_model_details = self .model_details
527
+ if updated_model_details and updated_model_details .items and model_details :
528
+ for model_id in model_details .items :
529
+ if model_id not in updated_model_details ["items" ]:
530
+ logger .warning ("Model Id" + model_id + " doesnt exist or you do not have the permission" )
536
531
537
532
def remove_models (self , model_details : ModelDetails ) -> "Dataset" :
538
533
"""remove model details from the dataset, remove from the existing dataset model id list
0 commit comments