From a11f5033695916898fd653577e3ac31fcaa88023 Mon Sep 17 00:00:00 2001 From: Vipul Date: Fri, 31 Jan 2025 16:20:10 +0530 Subject: [PATCH 1/3] switch cache delete default to false --- ads/aqua/extension/model_handler.py | 2 +- ads/aqua/model/entities.py | 2 +- tests/unitary/with_extras/aqua/test_model.py | 12 ++++++------ tests/unitary/with_extras/aqua/test_model_handler.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ads/aqua/extension/model_handler.py b/ads/aqua/extension/model_handler.py index 54c36d2c8..83cfe3a6e 100644 --- a/ads/aqua/extension/model_handler.py +++ b/ads/aqua/extension/model_handler.py @@ -133,7 +133,7 @@ def post(self, *args, **kwargs): # noqa: ARG002 ) local_dir = input_data.get("local_dir") cleanup_model_cache = ( - str(input_data.get("cleanup_model_cache", "true")).lower() == "true" + str(input_data.get("cleanup_model_cache", "false")).lower() == "true" ) inference_container_uri = input_data.get("inference_container_uri") allow_patterns = input_data.get("allow_patterns") diff --git a/ads/aqua/model/entities.py b/ads/aqua/model/entities.py index 6dd5eba21..28ad578b9 100644 --- a/ads/aqua/model/entities.py +++ b/ads/aqua/model/entities.py @@ -283,7 +283,7 @@ class ImportModelDetails(CLIBuilderMixin): os_path: str download_from_hf: Optional[bool] = True local_dir: Optional[str] = None - cleanup_model_cache: Optional[bool] = True + cleanup_model_cache: Optional[bool] = False inference_container: Optional[str] = None finetuning_container: Optional[str] = None compartment_id: Optional[str] = None diff --git a/tests/unitary/with_extras/aqua/test_model.py b/tests/unitary/with_extras/aqua/test_model.py index 3eb732aae..13c0cebd1 100644 --- a/tests/unitary/with_extras/aqua/test_model.py +++ b/tests/unitary/with_extras/aqua/test_model.py @@ -1200,14 +1200,14 @@ def test_import_model_with_input_tags( "model": "oracle/oracle-1it", "inference_container": "odsc-vllm-serving", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --inference_container odsc-vllm-serving", ), ( { "os_path": "oci://aqua-bkt@aqua-ns/path", "model": "ocid1.datasciencemodel.oc1.iad.", }, - "ads aqua model register --model ocid1.datasciencemodel.oc1.iad. --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True", + "ads aqua model register --model ocid1.datasciencemodel.oc1.iad. --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False", ), ( { @@ -1215,7 +1215,7 @@ def test_import_model_with_input_tags( "model": "oracle/oracle-1it", "download_from_hf": False, }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --cleanup_model_cache True", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --cleanup_model_cache False", ), ( { @@ -1224,7 +1224,7 @@ def test_import_model_with_input_tags( "download_from_hf": True, "model_file": "test_model_file", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --model_file test_model_file", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --model_file test_model_file", ), ( { @@ -1233,7 +1233,7 @@ def test_import_model_with_input_tags( "inference_container": "odsc-tei-serving", "inference_container_uri": ".ocir.io//", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --inference_container odsc-tei-serving --inference_container_uri .ocir.io//", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --inference_container odsc-tei-serving --inference_container_uri .ocir.io//", ), ( { @@ -1244,7 +1244,7 @@ def test_import_model_with_input_tags( "defined_tags": {"dtag1": "dvalue1", "dtag2": "dvalue2"}, }, "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path " - "--download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving --freeform_tags " + "--download_from_hf True --cleanup_model_cache False --inference_container odsc-vllm-serving --freeform_tags " '{"ftag1": "fvalue1", "ftag2": "fvalue2"} --defined_tags {"dtag1": "dvalue1", "dtag2": "dvalue2"}', ), ], diff --git a/tests/unitary/with_extras/aqua/test_model_handler.py b/tests/unitary/with_extras/aqua/test_model_handler.py index 391f6a19d..9f374a7c2 100644 --- a/tests/unitary/with_extras/aqua/test_model_handler.py +++ b/tests/unitary/with_extras/aqua/test_model_handler.py @@ -214,7 +214,7 @@ def test_register( model_file=model_file, download_from_hf=download_from_hf, local_dir=None, - cleanup_model_cache=True, + cleanup_model_cache=False, inference_container_uri=inference_container_uri, allow_patterns=allow_patterns, ignore_patterns=ignore_patterns, From 5e2e4f4a4c168886325817a929b43c47c2ae1c13 Mon Sep 17 00:00:00 2001 From: Vipul Date: Fri, 31 Jan 2025 16:20:10 +0530 Subject: [PATCH 2/3] switch cache delete default to false --- ads/aqua/extension/model_handler.py | 2 +- ads/aqua/model/entities.py | 2 +- tests/unitary/with_extras/aqua/test_model.py | 12 ++++++------ tests/unitary/with_extras/aqua/test_model_handler.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ads/aqua/extension/model_handler.py b/ads/aqua/extension/model_handler.py index 54c36d2c8..83cfe3a6e 100644 --- a/ads/aqua/extension/model_handler.py +++ b/ads/aqua/extension/model_handler.py @@ -133,7 +133,7 @@ def post(self, *args, **kwargs): # noqa: ARG002 ) local_dir = input_data.get("local_dir") cleanup_model_cache = ( - str(input_data.get("cleanup_model_cache", "true")).lower() == "true" + str(input_data.get("cleanup_model_cache", "false")).lower() == "true" ) inference_container_uri = input_data.get("inference_container_uri") allow_patterns = input_data.get("allow_patterns") diff --git a/ads/aqua/model/entities.py b/ads/aqua/model/entities.py index 6dd5eba21..28ad578b9 100644 --- a/ads/aqua/model/entities.py +++ b/ads/aqua/model/entities.py @@ -283,7 +283,7 @@ class ImportModelDetails(CLIBuilderMixin): os_path: str download_from_hf: Optional[bool] = True local_dir: Optional[str] = None - cleanup_model_cache: Optional[bool] = True + cleanup_model_cache: Optional[bool] = False inference_container: Optional[str] = None finetuning_container: Optional[str] = None compartment_id: Optional[str] = None diff --git a/tests/unitary/with_extras/aqua/test_model.py b/tests/unitary/with_extras/aqua/test_model.py index 3eb732aae..13c0cebd1 100644 --- a/tests/unitary/with_extras/aqua/test_model.py +++ b/tests/unitary/with_extras/aqua/test_model.py @@ -1200,14 +1200,14 @@ def test_import_model_with_input_tags( "model": "oracle/oracle-1it", "inference_container": "odsc-vllm-serving", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --inference_container odsc-vllm-serving", ), ( { "os_path": "oci://aqua-bkt@aqua-ns/path", "model": "ocid1.datasciencemodel.oc1.iad.", }, - "ads aqua model register --model ocid1.datasciencemodel.oc1.iad. --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True", + "ads aqua model register --model ocid1.datasciencemodel.oc1.iad. --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False", ), ( { @@ -1215,7 +1215,7 @@ def test_import_model_with_input_tags( "model": "oracle/oracle-1it", "download_from_hf": False, }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --cleanup_model_cache True", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --cleanup_model_cache False", ), ( { @@ -1224,7 +1224,7 @@ def test_import_model_with_input_tags( "download_from_hf": True, "model_file": "test_model_file", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --model_file test_model_file", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --model_file test_model_file", ), ( { @@ -1233,7 +1233,7 @@ def test_import_model_with_input_tags( "inference_container": "odsc-tei-serving", "inference_container_uri": ".ocir.io//", }, - "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --inference_container odsc-tei-serving --inference_container_uri .ocir.io//", + "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache False --inference_container odsc-tei-serving --inference_container_uri .ocir.io//", ), ( { @@ -1244,7 +1244,7 @@ def test_import_model_with_input_tags( "defined_tags": {"dtag1": "dvalue1", "dtag2": "dvalue2"}, }, "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path " - "--download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving --freeform_tags " + "--download_from_hf True --cleanup_model_cache False --inference_container odsc-vllm-serving --freeform_tags " '{"ftag1": "fvalue1", "ftag2": "fvalue2"} --defined_tags {"dtag1": "dvalue1", "dtag2": "dvalue2"}', ), ], diff --git a/tests/unitary/with_extras/aqua/test_model_handler.py b/tests/unitary/with_extras/aqua/test_model_handler.py index 391f6a19d..9f374a7c2 100644 --- a/tests/unitary/with_extras/aqua/test_model_handler.py +++ b/tests/unitary/with_extras/aqua/test_model_handler.py @@ -214,7 +214,7 @@ def test_register( model_file=model_file, download_from_hf=download_from_hf, local_dir=None, - cleanup_model_cache=True, + cleanup_model_cache=False, inference_container_uri=inference_container_uri, allow_patterns=allow_patterns, ignore_patterns=ignore_patterns, From 26417f2517edc8b8363a488121bce5bb1823544a Mon Sep 17 00:00:00 2001 From: Vipul Date: Mon, 3 Feb 2025 17:13:34 +0530 Subject: [PATCH 3/3] fix test after merge conflict resolved --- tests/unitary/with_extras/aqua/test_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unitary/with_extras/aqua/test_model.py b/tests/unitary/with_extras/aqua/test_model.py index f61ee626a..daafb2bed 100644 --- a/tests/unitary/with_extras/aqua/test_model.py +++ b/tests/unitary/with_extras/aqua/test_model.py @@ -1281,6 +1281,7 @@ def test_import_model_with_input_tags( "model": "oracle/oracle-1it", "inference_container": "odsc-vllm-serving", "ignore_model_artifact_check": True, + "cleanup_model_cache": True, }, "ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving --ignore_model_artifact_check True", ),