diff --git a/ads/aqua/extension/model_handler.py b/ads/aqua/extension/model_handler.py index 029d71643..269337d2d 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 dfd1ac374..991c67b54 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 4cd59afb9..daafb2bed 100644 --- a/tests/unitary/with_extras/aqua/test_model.py +++ b/tests/unitary/with_extras/aqua/test_model.py @@ -1228,14 +1228,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", ), ( { @@ -1243,7 +1243,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", ), ( { @@ -1252,7 +1252,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", ), ( { @@ -1261,7 +1261,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//", ), ( { @@ -1272,7 +1272,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"}', ), ( @@ -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", ), diff --git a/tests/unitary/with_extras/aqua/test_model_handler.py b/tests/unitary/with_extras/aqua/test_model_handler.py index af9165f63..a9236597d 100644 --- a/tests/unitary/with_extras/aqua/test_model_handler.py +++ b/tests/unitary/with_extras/aqua/test_model_handler.py @@ -219,7 +219,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,