github 以及 huggingface下载模型和数据

runningcheese/MirrorSite: 镜像网站合集 (github.com)

huggingface

下载模型和数据使用snapshot_download的方法

不会修改HuggingFace模型下载默认缓存路径?一篇教会你!_huggingface默认下载路径-CSDN博客

下载模型

使用snapshot_download

使用snapshot_download配置代理多线程下载模型 - 风之炼金术士华华 - 博客园

直接使用git下载

复制代码
GIT_LFS_SKIP_SMUDGE=1 git clone git clone https://huggingface.co/facebook/
opt-125m
cd opt-125m
git lfs pull --include="*.bin"

下载数据

使用snapshot_download

python 复制代码
import os
from huggingface_hub import snapshot_download
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
snapshot_download(repo_id = 'liuhaotian/LLaVA-CC3M-Pretrain-595K',  
                  repo_type="dataset",  # 可选 [dataset,model] 
                   local_dir='/home/jsh/code/Train_llava/Data',# 下载到本地的路径
                     resume_download=True, # 断点续传
                     ) 

使用 datasets的load_dataset

python 复制代码
from datasets import load_dataset, Dataset 
dataset = load_dataset("gsm8k",'main',split='train')

如果是本地没有缓存那么会下载到路径

https://zhuanlan.zhihu.com/p/620652410

Windows系统中,HuggingFace模型的默认保存位置是C:\Users\username\.cache\huggingface\transformers。您可以更改shell环境变量来指定不同的缓存目录。例如,您可以更改默认的shell环境变量TRANSFORMERS_CACHE或者HF_HOME + transformers/

文件储存格式

会先把原文件格式下下来然后生成保存成.arrow文件

复制代码
(hf_dataset_download) PS C:\code\hf_dataset_download> python .\dataset_modelscope.py
README.md: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7.94k/7.94k [00:00<?, ?B/s]
C:\Users\13783\.conda\envs\hf_dataset_download\lib\site-packages\huggingface_hub\file_download.py:139: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\13783\.cache\huggingface\hub\datasets--gsm8k. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
  warnings.warn(message)
train-00000-of-00001.parquet: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.31M/2.31M [00:00<00:00, 2.40MB/s]
test-00000-of-00001.parquet: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 419k/419k [00:00<00:00, 8.18MB/s]
Generating train split: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7473/7473 [00:00<00:00, 678809.61 examples/s] 
Generating test split: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1319/1319 [00:00<00:00, 439105.24 examples/s] 

修改下载位置

通过datasets加载数据集

加载 - Hugging Face 中文

github

github下载国内镜像网站

|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ▼ GitHub | 镜像网站 |
| GitHub 访问 | 在任意 github 链接后面 加上 fast,也就是 githubfast.com,[示例](https://githubfast.com/runningcheese/Awesome-AI "示例") |
| ↳ | 在任意 github 链接前面 加上 521,也就是 521github.com,[示例](https://521github.com/runningcheese/Awesome-AI "示例") |
| ↳ | 在任意 github 链接前面 加上 kk,也就是 kkgithub.com,[示例](https://kkgithub.com/runningcheese/RunningCheese-Firefox "示例") |
| GitHub 下载 | 在 github 下载链接前面加上 https://mirror.ghproxy.com,[示例](https://mirror.ghproxy.com/https://github.com/syncthing/syncthing-macos/releases/download/v1.23.4-1/Syncthing-1.23.4-1.dmg "示例") |
| GitHub 文件夹 | 项目地址,解决 GitHub 只能下载整个项目的问题。 |
| GitHub CDN | https://gcore.jsdelivr.net,180ms 延迟,海外服务器,有缓存。[示列](https://gcore.jsdelivr.net/gh/runningcheese/RunningCheese-Firefox/Restore/Adblock_Watermark.txt "示列") |
| ↳ | https://cdn.jsdelivr.net,180ms 延迟,海外服务器,有缓存。[示列](https://cdn.jsdelivr.net/gh/runningcheese/RunningCheese-Firefox/Restore/Adblock_Watermark.txt "示列") |
| ↳ | https://jsd.onmicrosoft.cn,15ms 延迟,国外服务器,无缓存。[示列](https://jsd.onmicrosoft.cn/gh/runningcheese/RunningCheese-Firefox/Restore/Adblock_Watermark.txt "示列") |
| ↳ | https://jsd.cdn.zzko.cn,30ms 延迟,国外服务器,无缓存。[示列](https://jsd.cdn.zzko.cn/gh/runningcheese/RunningCheese-Firefox/Restore/Adblock_Watermark.txt "示列") |
| Stackoverflow | fsou,在原网页前加上链接。[示例](https://stackoverflow.nilmap.com/question?dest_url=https://stackoverflow.com/questions/8493589/is-there-a-css-media-query-to-detect-windows "示例") |

相关推荐
miofly1 天前
Genie 4新增原生音频,实时世界模型加入声音生成
开源·github
dong_junshuai1 天前
每天一个开源项目#155 MuJoCo:从接触求解到控制时序的物理引擎
github
GitHub实测笔记1 天前
eza 本机实测:一万文件 -l 中位 48ms、ls 21.5ms;脚本里裸跑 eza 输出为空
github
一条Go1 天前
开源新生代雷达 · 第 04 期
github
一条Go1 天前
告警指纹:一次故障为什么只产生一条 FIRING 记录
后端·架构·github
wyxspark1 天前
在本地 AI 中实现绝对可复现:一份 12,810 条哈希的硬核工程记录
github
简创AIGC陶先生1 天前
【直播切片工作台】第31章:任务接口与任务服务
github
用户2991422196801 天前
GitHub 热榜项目:日榜(2026-11-10)
人工智能·开源·github
miofly1 天前
Meta发布小模型Muse Ember,智能体基准多项超GPT-6与Claude Haiku 5.5
开源·github
wflynn1 天前
GitHub 日榜趋势速报 | 2026-11-09
开源·github