-
Notifications
You must be signed in to change notification settings - Fork 658
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
[HfFileSystem] Reuse caching when downloading a file #1452
Comments
The If we decide to implement it, what would be the best way of handling non- |
Just to explain a bit more (and sum up an private slack convo): Ideally I would like that
caches the More precisely:
Note from @mariosasko: case
We don't want to go in that direction unless we have a strong community demand. Having a 2nd cache system would lead to more maintenance and confusion. If we start to cache files locally before reading them, we should implement a WholeFileCacheFileSystem. @mariosasko would it be possible to adapt the current implement to be a |
So, I think it's best to add a method (or attribute) to |
In hffs, we implement
_fetch_range
which allows to retrieve bytes from a remote file without downloading it entirely (see fsspec). This is nice when downloading only parts of a file but it we want to download it entirely, it would be best to benefit from the existinghf_hub_download
than using the HF cache system.@mariosasko @lhoestq given your knowledge of
fsspec
, do you think it would be possible to overwrite theread
method so that ifread
is called withlength=-1
, then we cache the entire file and read it from disk? And iflength!=-1
we default back to the normal implementation. Do you see any weird side effect that this could cause?Also for
_fetch_range
instead of always fetching from remote, we could try to find the file locally first.Otherwise I saw that they also define a
BaseCache
object that we could extend. To you think it's worth trying to tweak it to use our existing cache?The text was updated successfully, but these errors were encountered: