Skip to content

Commit 3569ba7

Browse files
change field to cleanup_model_cache
1 parent b7ed253 commit 3569ba7

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

ads/aqua/extension/model_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def post(self, *args, **kwargs): # noqa: ARG002
129129
str(input_data.get("download_from_hf", "false")).lower() == "true"
130130
)
131131
local_dir = input_data.get("local_dir")
132-
delete_from_local = (
133-
str(input_data.get("delete_from_local", "true")).lower() == "true"
132+
cleanup_model_cache = (
133+
str(input_data.get("cleanup_model_cache", "true")).lower() == "true"
134134
)
135135
inference_container_uri = input_data.get("inference_container_uri")
136136
allow_patterns = input_data.get("allow_patterns")
@@ -144,7 +144,7 @@ def post(self, *args, **kwargs): # noqa: ARG002
144144
os_path=os_path,
145145
download_from_hf=download_from_hf,
146146
local_dir=local_dir,
147-
delete_from_local=delete_from_local,
147+
cleanup_model_cache=cleanup_model_cache,
148148
inference_container=inference_container,
149149
finetuning_container=finetuning_container,
150150
compartment_id=compartment_id,

ads/aqua/model/entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class ImportModelDetails(CLIBuilderMixin):
283283
os_path: str
284284
download_from_hf: Optional[bool] = True
285285
local_dir: Optional[str] = None
286-
delete_from_local: Optional[bool] = True
286+
cleanup_model_cache: Optional[bool] = True
287287
inference_container: Optional[str] = None
288288
finetuning_container: Optional[str] = None
289289
compartment_id: Optional[str] = None

ads/aqua/model/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ def register(
13641364
ignore_patterns (list): Model files matching any of the patterns are not downloaded.
13651365
Example: ["*.json"] will ignore all .json files. ["folder/*"] will ignore all files under `folder`.
13661366
Patterns are Standard Wildcards (globbing patterns) and rules can be found here: https://docs.python.org/3/library/fnmatch.html
1367-
delete_from_local (bool): Deletes downloaded files from local machine after model is successfully
1367+
cleanup_model_cache (bool): Deletes downloaded files from local machine after model is successfully
13681368
registered. Set to True by default.
13691369
13701370
Returns:
@@ -1477,7 +1477,7 @@ def register(
14771477

14781478
if (
14791479
import_model_details.download_from_hf
1480-
and import_model_details.delete_from_local
1480+
and import_model_details.cleanup_model_cache
14811481
):
14821482
cleanup_local_hf_model_artifact(
14831483
model_name=model_name, local_dir=import_model_details.local_dir

tests/unitary/with_extras/aqua/test_model.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def test_get_model_fine_tuned(
653653
}
654654

655655
@pytest.mark.parametrize(
656-
("artifact_location_set", "download_from_hf", "delete_from_local"),
656+
("artifact_location_set", "download_from_hf", "cleanup_model_cache"),
657657
[
658658
(True, True, True),
659659
(True, False, True),
@@ -683,7 +683,7 @@ def test_import_verified_model(
683683
mock_ocidsc_create,
684684
artifact_location_set,
685685
download_from_hf,
686-
delete_from_local,
686+
cleanup_model_cache,
687687
mock_get_hf_model_info,
688688
mock_init_client,
689689
):
@@ -748,7 +748,7 @@ def test_import_verified_model(
748748
os_path=os_path,
749749
local_dir=str(tmpdir),
750750
download_from_hf=True,
751-
delete_from_local=delete_from_local,
751+
cleanup_model_cache=cleanup_model_cache,
752752
allow_patterns=["*.json"],
753753
ignore_patterns=["test.json"],
754754
)
@@ -763,7 +763,7 @@ def test_import_verified_model(
763763
f"oci os object bulk-upload --src-dir {str(tmpdir)}/{model_name} --prefix prefix/path/{model_name}/ -bn aqua-bkt -ns aqua-ns --auth api_key --profile DEFAULT --no-overwrite --exclude {HF_METADATA_FOLDER}*"
764764
)
765765
)
766-
if delete_from_local:
766+
if cleanup_model_cache:
767767
cache_dir = os.path.join(
768768
os.path.expanduser("~"),
769769
".cache",
@@ -1199,22 +1199,22 @@ def test_import_model_with_input_tags(
11991199
"model": "oracle/oracle-1it",
12001200
"inference_container": "odsc-vllm-serving",
12011201
},
1202-
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --delete_from_local True --inference_container odsc-vllm-serving",
1202+
"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",
12031203
),
12041204
(
12051205
{
12061206
"os_path": "oci://aqua-bkt@aqua-ns/path",
12071207
"model": "ocid1.datasciencemodel.oc1.iad.<OCID>",
12081208
},
1209-
"ads aqua model register --model ocid1.datasciencemodel.oc1.iad.<OCID> --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --delete_from_local True",
1209+
"ads aqua model register --model ocid1.datasciencemodel.oc1.iad.<OCID> --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --cleanup_model_cache True",
12101210
),
12111211
(
12121212
{
12131213
"os_path": "oci://aqua-bkt@aqua-ns/path",
12141214
"model": "oracle/oracle-1it",
12151215
"download_from_hf": False,
12161216
},
1217-
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --delete_from_local True",
1217+
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf False --cleanup_model_cache True",
12181218
),
12191219
(
12201220
{
@@ -1223,7 +1223,7 @@ def test_import_model_with_input_tags(
12231223
"download_from_hf": True,
12241224
"model_file": "test_model_file",
12251225
},
1226-
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --delete_from_local True --model_file test_model_file",
1226+
"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",
12271227
),
12281228
(
12291229
{
@@ -1232,7 +1232,7 @@ def test_import_model_with_input_tags(
12321232
"inference_container": "odsc-tei-serving",
12331233
"inference_container_uri": "<region>.ocir.io/<your_tenancy>/<your_image>",
12341234
},
1235-
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path --download_from_hf True --delete_from_local True --inference_container odsc-tei-serving --inference_container_uri <region>.ocir.io/<your_tenancy>/<your_image>",
1235+
"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 <region>.ocir.io/<your_tenancy>/<your_image>",
12361236
),
12371237
(
12381238
{
@@ -1243,7 +1243,7 @@ def test_import_model_with_input_tags(
12431243
"defined_tags": {"dtag1": "dvalue1", "dtag2": "dvalue2"},
12441244
},
12451245
"ads aqua model register --model oracle/oracle-1it --os_path oci://aqua-bkt@aqua-ns/path "
1246-
"--download_from_hf True --delete_from_local True --inference_container odsc-vllm-serving --freeform_tags "
1246+
"--download_from_hf True --cleanup_model_cache True --inference_container odsc-vllm-serving --freeform_tags "
12471247
'{"ftag1": "fvalue1", "ftag2": "fvalue2"} --defined_tags {"dtag1": "dvalue1", "dtag2": "dvalue2"}',
12481248
),
12491249
],

tests/unitary/with_extras/aqua/test_model_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_register(
214214
model_file=model_file,
215215
download_from_hf=download_from_hf,
216216
local_dir=None,
217-
delete_from_local=True,
217+
cleanup_model_cache=True,
218218
inference_container_uri=inference_container_uri,
219219
allow_patterns=allow_patterns,
220220
ignore_patterns=ignore_patterns,

0 commit comments

Comments
 (0)