Is it possible to set the location for huggingface cache? I use a disk specifically for datasets and model backups. Or is it something I have to solve with Unix plumbing (soft links etc)?
There’s a couple different ways to customize the caching directories! You can set a cache for datasets with the HF_DATASETS_CACHE
environment variable, or with cache_dir
as a parameter when you load a dataset. For models, there’s a similar environment variable.
This is a higher-level doc about how caching across the HF ecosystem works, which may or may not be interesting to you.
Hope this helps!
Hello,
I am fighting with the cache dir location on Win10Pro and I cannot find a solution to change it.
I have tried the following code to force the datasets and models elements download on my E drive and it fails. Surprisingly when I use the same location path in the cache_dir parameter for loading the datasets, it works fine.
os.environ[‘HF_HOME’] = ‘E:\01- NLP Projects\02- Hugging Face\.cache’
os.environ[‘HUGGINGFACE_HUB_CACHE’] = ‘E:\01- NLP Projects\02- Hugging Face\.cache’
os.environ[‘TRANSFORMERS_CACHE’] = ‘E:\01- NLP Projects\02- Hugging Face\.cache’
os.environ[‘HF_DATASETS_CACHE’] = ‘E:\01- NLP Projects\02- Hugging Face\.cache’
Thanks for your help and feedback.
Best regards
Jerome