-
Notifications
You must be signed in to change notification settings - Fork 36
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
Implement cache for downloaded models. #8
Conversation
It is failing b/c I am using the However, the I will find another way to set the environment variable cleanly in tests. |
Default cache directory is ~/.cache/kagglehub. Can be overriden globally by KAGGLEHUB_CACHE env variable. Can be overriden for a single call using the `cache_dir` parameter. Also include logic for parsing the model handle. Next: Implement downloading file on cache miss. http://b/305949898
|
||
def _install_resolvers(): |
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.
moved this logic directly to __init__.py
to avoid cyclical dependencies.
|
||
DEFAULT_CACHE_FOLDER = os.path.join(Path.home(), ".cache", "kagglehub") |
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.
Could it be possible that this .cache
directory doesn't exist? Should we check and create it otherwise?
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.
Yes, it will likely not exist. My thinking was that the caller (here, the HttpResolver) would call "os.makedirs()" with the path to the model before copying the file which will create all intermediaries folder.
Default cache directory is ~/.cache/kagglehub.
Can be overriden globally by KAGGLEHUB_CACHE env variable. Can be overriden for a single call using the
cache_dir
parameter.Also include logic for parsing the model handle.
Next: Implement downloading file on cache miss.
http://b/305947384