How to add model repo's snapshots to the Hugging Face cache?

I’ve downloaded model snapshots from huggingface hub using huggingface-cli.
Then, is there any way to add model snapshots downloaded from Hugging Face Hub to the Hugging Face cache (~/.cache/huggingface)?

1 Like

If it is a non-Windows OS, I think it is stored in the cache when it is from_pretrained.
In the case of Windows, it may not be stored in the cache unless you run it with administrator privileges, or it may be stored somewhere else.

If you are talking about putting a normal download in the cache, you should not do that unless you have a very bad connection.
It is definitely faster to re-download.
You will have to create some additional information yourself in addition to the path as shown below, but you will have to look at the library code to see how to accurately calculate this hash value.

Example

~\.cache\huggingface\misc\hub\models--google-t5--t5-small\snapshots\df1b051c49625cf57a3d0d8d3863ed4d13564fe4

But on the other hand, it is easy to modify the cache once it has been stored in a legitimate way.