Skip to content

Commit 7a41a71

Browse files
Fixing conflict in OCIDatascienceModel Due to is_model_by_reference with latest preview sdk (#1094)
2 parents 60c6daa + 2fc5b9b commit 7a41a71

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

ads/model/artifact_downloader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ def _download(self):
170170
"""Downloads model artifacts."""
171171
self.progress.update("Importing model artifacts from catalog")
172172

173-
if self.dsc_model._is_model_by_reference() and self.model_file_description:
173+
if (
174+
self.dsc_model.is_model_created_by_reference()
175+
and self.model_file_description
176+
):
174177
self.download_from_model_file_description()
175178
self.progress.update()
176179
return

ads/model/datascience_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ def _update_from_oci_dsc_model(
17791779
artifact_info["Content-Disposition"]
17801780
)
17811781

1782-
if self.dsc_model._is_model_by_reference():
1782+
if self.dsc_model.is_model_created_by_reference():
17831783
_, file_extension = os.path.splitext(file_name_info["filename"])
17841784
if file_extension.lower() == ".json":
17851785
bucket_uri, _ = self._download_file_description_artifact()

ads/model/service/oci_datascience_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def from_id(cls, ocid: str) -> "OCIDataScienceModel":
579579
raise ValueError("Model OCID not provided.")
580580
return super().from_ocid(ocid)
581581

582-
def _is_model_by_reference(self):
582+
def is_model_created_by_reference(self):
583583
"""Checks if model is created by reference
584584
Returns
585585
-------

tests/unitary/default_setup/model/test_artifact_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_download_large_artifact_from_model_file_description(self, mock_download
189189
"""Tests whether model_file_description is loaded within downloader and is parsed, and also if
190190
# download_from_model_file_description is appropriately called."""
191191

192-
self.mock_dsc_model._is_model_by_reference.return_value = True
192+
self.mock_dsc_model.is_model_created_by_reference.return_value = True
193193
self.mock_artifact_file_path = os.path.join(
194194
self.curr_dir, "test_files/model_description.json"
195195
)

tests/unitary/default_setup/model/test_datascience_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def test__to_oci_dsc_model(self):
613613
True,
614614
],
615615
)
616-
@patch.object(OCIDataScienceModel, "_is_model_by_reference")
616+
@patch.object(OCIDataScienceModel, "is_model_created_by_reference")
617617
@patch.object(OCIDataScienceModel, "get_artifact_info")
618618
@patch.object(OCIDataScienceModel, "get_model_provenance")
619619
@patch.object(DataScienceModel, "_download_file_description_artifact")

tests/unitary/default_setup/model/test_oci_datascience_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def test_is_model_by_reference(self):
473473
category="Other",
474474
)
475475
self.mock_model.custom_metadata_list = [metadata_item]
476-
assert not self.mock_model._is_model_by_reference()
476+
assert not self.mock_model.is_model_created_by_reference()
477477

478478
metadata_item = ModelCustomMetadataItem(
479479
key="modelDescription",
@@ -483,4 +483,4 @@ def test_is_model_by_reference(self):
483483
)
484484
self.mock_model.custom_metadata_list = [metadata_item]
485485

486-
assert self.mock_model._is_model_by_reference()
486+
assert self.mock_model.is_model_created_by_reference()

0 commit comments

Comments
 (0)