-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ODSC-6682] Delete HF cache by default while registering models #1044
base: main
Are you sure you want to change the base?
Conversation
ads/aqua/extension/model_handler.py
Outdated
@@ -128,6 +128,10 @@ def post(self, *args, **kwargs): # noqa: ARG002 | |||
download_from_hf = ( | |||
str(input_data.get("download_from_hf", "false")).lower() == "true" | |||
) | |||
local_dir = input_data.get("local_dir") | |||
delete_from_local = ( | |||
str(input_data.get("delete_from_local", "true")).lower() == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOuldn't it be better to name it something like - cleanup_model_cache
? I don't have a strong opinion, but delete_from_local
doesn't sound intuitive for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that you called it out, it does sounds a bit vague. I've updated the field to cleanup_model_cache
.
Description
Issue
When a user registered a model in AI Quick Actions, the
/dev/sdb
drive space would get occupied and take up 100% of the space for some users. Currently, acached-model
folder is created when user does not set the local directory.Solution
In this PR, we delete the model cache by default after a model is registered. The
cached-model
folder will also not be created, instead the artifacts of model namedoracle/aqua-1t-mega-model
will be written to the.cache/huggingface/hub/models--oracle--aqua-1t-mega-model/
folder. Once a model is successfully registered, the artifacts are removed from two places:local_dir
if specified.cache/huggingface/hub/models--*/
folder that removes other relevant metadata and artifacts (iflocal_dir
was not specifed)If a user wishes to keep the artifacts, then they need to set
delete_from_local
as False explicitly.Testing [WIP]
In Progress, will add some examples here.
Unit Tests