更改所有HuggingFace数据的默认缓存路径。

huangapple go评论126阅读模式
英文:

Changing the Default Cache Path for All HuggingFace Data

问题

Huggingface的默认缓存路径位于~/.cache/huggingface,在该文件夹中有多个缓存文件,如modelshub

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

huangapple
  • 本文由 发表于 2023年7月23日 20:38:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76748279.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定