-
Notifications
You must be signed in to change notification settings - Fork 590
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
Fix snapshot download when local_dir
is provided.
#2592
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Thanks for spotting and fixing this!
thanks for the review! I added your suggestions here : f3a8bbb |
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.
Thanks!
…x-local-dir-snapshot-download
let's merge this :) |
* Fix snapshot download when local_dir is provided * Fix tests docstring * Add comment * Fixes post-review
This PR fixes a bug reported internally in this private slack message.
Issue
The issue comes from
huggingface_hub.snapshot_download()
which does not return the folder that already contains the downloaded files if:local_dir
is provided.local_files_only=True
orHF_HUB_OFFLINE=True
).Fix
When
local_dir
is provided, we should check if it exists and contains files, as it's expected to have the latest version of the repo replicated there rather than in a snapshot folder.