Skip to content
共绩算力文档中心

学术镜像加速

本功能仅面向高校、科研机构及在读学生等学术用途,用于缓解 GitHub、Hugging Face 等学术资源在国内访问缓慢的问题。

所列加速代理均为第三方公益镜像或平台自建转发节点,不承诺可用性、带宽或持久稳定性。

如遇恶意攻击、流量异常、法律政策调整或镜像站本身故障,平台有权随时暂停或终止该加速服务,恕不另行通知。

举例:

Terminal window
git clone https://ghfast.top/https://github.com/stilleshan/dockerfiles

举例:

Terminal window
wget https://ghfast.top/https://github.com/stilleshan/dockerfiles/archive/master.zip

举例:

Terminal window
curl -O https://ghfast.top/https://github.com/stilleshan/dockerfiles/archive/master.zip

方法一 使用环境变量(非侵入式)

Section titled “方法一 使用环境变量(非侵入式)”

无需改动现有代码,只在运行命令前临时指定镜像地址即可,适用于多数场景。huggingface 工具链会读取 HF_ENDPOINT 环境变量来确定下载源。

HF_ENDPOINT=https://hf-mirror.com python your_script.py

若个别数据集依赖其自带的下载脚本,则可能需要在该脚本中手动将相关网址替换为镜像地址以完成加速。

方法二 通过 huggingface-cli 加速下载

Section titled “方法二 通过 huggingface-cli 加速下载”
  1. 安装依赖
pip install -U huggingface_hub
  1. 设置环境变量(区分 Linux 与 Windows 系统)
export HF_ENDPOINT=https://hf-mirror.com

建议将上面的命令写入 ~/.bashrc 以便持久生效。

  1. 下载模型与数据集

下载模型案例

hf download gpt2 --local-dir gpt2 --local-dir-use-symlinks False

下载数据集案例

hf download wikitext --repo-type dataset --local-dir wikitext --local-dir-use-symlinks False

此处建议添加 --local-dir-use-symlinks False 以禁用软链接以防止造成兼容性问题。