# Change cache directory

**URL:** <https://discuss.huggingface.co/t/change-cache-directory/25169>\
**Category:** Beginners\
**Created:** [October 29, 2022, 5:05am UTC](https://discuss.huggingface.co/t/change-cache-directory/25169 "2022-10-29T05:05:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![exihs](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@exihs](https://discuss.huggingface.co/u/exihs)\
**Post date:** [October 29, 2022, 5:05am UTC](https://discuss.huggingface.co/t/change-cache-directory/25169/1 "2022-10-29T05:05:40Z")

</div>

I am trying to change the default cache directory of where the models are installed to.

I have attempted to change the environment variable

> set HF\_DATASETS\_CACHE=“D:/Users/b/Downloads/cache/”

However, it is still installing in the .cache folder instead. How can I resolve this?

---

<div class="post-metadata">

**Author:** ![jmassot](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jmassot/32/32864_2.png) [@jmassot](https://discuss.huggingface.co/u/jmassot)\
**Post date:** [November 1, 2022, 3:23pm UTC](https://discuss.huggingface.co/t/change-cache-directory/25169/2 "2022-11-01T15:23:36Z")

</div>

I have the same issue here on Win10Pro. In my code, I try to force:  
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’

But still, HF is using the default cache directory for both dataset and model elements.  
I do not know how to fix it.

Cheers

Jerome
