英文:
Changing the Default Cache Path for All HuggingFace Data
问题
Huggingface的默认缓存路径位于~/.cache/huggingface
,在该文件夹中有多个缓存文件,如models
和hub
。
huggingface文档 指出,可以通过设置shell环境变量HF_DATASETS_CACHE
来修改默认的dataset
缓存位置,如下所示:
$ export HF_DATASETS_CACHE="/path/to/another/directory"
然而,我的目标是更改所有HuggingFace数据的默认缓存目录,而不仅仅是dataset
。我在HuggingFace文档中找不到相应的shell环境变量来完成这个任务。任何帮助将不胜感激。
英文:
The default cache path of huggingface is in ~/.cache/huggingface
, and in that folder, there are multiple cache files like models
, and hub
.
The huggingface documents indicates that the default dataset
cache location can be modified by setting the shell environment variable, HF_DATASETS_CACHE
to a different directory as shown below:
$ export HF_DATASETS_CACHE="/path/to/another/directory"
However, my objective is to alter the default cache directory for all HuggingFace data and not solely the dataset
. I am facing difficulties in finding the respective shell environment variable in the HuggingFace documentation to accomplish this. Any help would be appreciated.
答案1
得分: 2
翻译好的部分如下:
"HF_HOME" 变量似乎是指 此文档 所示的内容。因此,这个终端代码可能是解决方案:
export HF_HOME="/path/.cache/huggingface"
export HF_DATASETS_CACHE="/path/.cache/huggingface/datasets"
export TRANSFORMERS_CACHE="/path/.cache/huggingface/models"
附注:如果您想将更改永久保存,您应该将这些行写入您的 .bashrc
文件(也可以使用 .bash_profile
),方法是使用 nano ~/.bashrc
。
英文:
It seems that the variable is HF_HOME
as this document indicates. So probably this terminal code should be the solution:
export HF_HOME="/path/.cache/huggingface"
export HF_DATASETS_CACHE="/path/.cache/huggingface/datasets"
export TRANSFORMERS_CACHE="/path/.cache/huggingface/models"
p.s. If you want to make your change permanent, you should write these lines in your .bashrc
(Can do with .bash_profile
too) file using nano ~/.bashrc
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论