Skip to content

Commit e7a2f86

Browse files
authored
Merge branch 'main' into ODSC-69756/refactor_container_index_loader
2 parents f722fc1 + 7a41a71 commit e7a2f86

File tree

9 files changed

+45
-7
lines changed

9 files changed

+45
-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
-------

ads/opctl/operator/lowcode/forecast/model_evaluator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def create_operator_config(self, operator_config, backtest, model, historical_da
100100
backtest_op_config_draft = operator_config.to_dict()
101101
backtest_spec = backtest_op_config_draft["spec"]
102102
backtest_spec["historical_data"]["url"] = historical_data_url
103+
backtest_spec["datetime_column"]["format"] = None
103104
if backtest_spec["additional_data"]:
104105
backtest_spec["additional_data"]["url"] = additional_data_url
105106
backtest_spec["test_data"] = {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Store,Date,Sales
2+
1,01-07-2022,328
3+
1,01-08-2022,369
4+
1,01-09-2022,415
5+
1,01-10-2022,277
6+
1,01-11-2022,248
7+
1,01-12-2022,251
8+
1,01-07-2023,329
9+
1,01-08-2023,446

tests/operators/forecast/test_errors.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,5 +868,30 @@ def test_what_if_analysis(operator_setup, model):
868868
), f"Deployment info file not found at {deployment_metadata}"
869869

870870

871+
def test_auto_select(operator_setup):
872+
DATASET_PREFIX = f"{os.path.dirname(os.path.abspath(__file__))}/../data/timeseries/"
873+
tmpdirname = operator_setup
874+
historical_test_path = f"{DATASET_PREFIX}/dataset6.csv"
875+
model = "auto-select"
876+
yaml_i, output_data_path = populate_yaml(
877+
tmpdirname=tmpdirname,
878+
historical_data_path=historical_test_path,
879+
output_data_path=f"{tmpdirname}/{model}/results",
880+
)
881+
yaml_i["spec"].pop("additional_data")
882+
yaml_i["spec"]["horizon"] = 2
883+
yaml_i["spec"]["datetime_column"]["format"] = "%d-%m-%Y"
884+
yaml_i["spec"]["model"] = model
885+
yaml_i["spec"]["model_kwargs"] = {"model_list": ["prophet", "arima"]}
886+
887+
run_yaml(
888+
tmpdirname=tmpdirname,
889+
yaml_i=yaml_i,
890+
output_data_path=output_data_path,
891+
test_metrics_check=False,
892+
)
893+
report_path = f"{output_data_path}/report.html"
894+
assert os.path.exists(report_path), f"Report file not found at {report_path}"
895+
871896
if __name__ == "__main__":
872897
pass

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)