HF 环境变量

以 linux 为例,在~/.bashrc中添加如下内容:

1
2
3
export HUGGINGFACE_HUB_CACHE="/root/autodl-tmp/huggingface"  # 替换为你的缓存目录
export HF_HOME="/root/autodl-tmp/huggingface" # 替换为你的缓存目录
export HF_ENDPOINT=https://hf-mirror.com # HF镜像地址

然后执行source ~/.bashrc使环境变量生效。

注意:/autodl-tmp/huggingface是我在 autodl 上的一个临时目录,你可以根据自己的需要修改。

1
2
3
4
# 查看环境变量
echo $HUGGINGFACE_HUB_CACHE
echo $HF_HOME
echo $HF_ENDPOINT

如果输出以下结果,说明配置成功

1
2
3
/root/autodl-tmp/huggingface
/root/autodl-tmp/huggingface
https://hf-mirror.com

下载 huggingface-hub 库,使用 huggingface-cli login 命令登录 huggingface

Autodl 环境变量

Autodl 内置 git 加速通道 ( autodl 上 git 速度简直太慢了,真不如下载 zip )

1
2
3
4
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
# 能有个 几十Kb 的提升? /冒汗