当前位置: 首页 > article >正文

gh hugging face使用

install

sudo dpkg -i gh_2.74.0_linux_amd64.deb
gh auth login

gh auth login
? Where do you use GitHub? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org', 'workflow'.
? Paste your authentication token: *********************************************************************************************
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as HenryZhangJianhe

gh release list -R NVlabs/OmniDrive
gh release download v1.0 -D . -R NVlabs/OmniDrive

hugging face

use china mirror fast
git clone https://hf-mirror.com/exiawsh/pretrain_qformer

pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
如果使用python
$env:HF_ENDPOINT = “https://hf-mirror.com”

huggingface-cli download --resume-download gpt2 --local-dir gpt2
huggingface-cli download --repo-type dataset --resume-download wikitext --local-dir wikitext
真实模型则存储在~/.cache/huggingface下,如果不喜欢这个可以用 --local-dir-use-symlinks False取消这个逻辑。

huggingface-cli download exiawsh/pretrain_qformer

方法三:使用 hfd (推荐)
hfd 是https://hf-mirror.com/开发的 huggingface 专用下载工具,基于成熟工具 git+aria2,可以做到稳定下载不断线。1. 下载hfd
wget https://hf-mirror.com/hfd/hfd.sh
chmod a+x hfd.sh
AI写代码
python
运行
2. 设置环境变量
HF_ENDPOINT 该变量是 HF 相关库官方支持的一个环境变量,设置后,相关库会尊重该变量指定的主机名,替换 huggingface.co 域名进行模型、数据集的下载和上传,从而做到无需修改python的transformers代码,即可利用上镜像站来加载模型。具体支持以下库:huggingface-cli
snapshot_download
from_pretrained
hf_hub_download
timm.create_model
Linuxexport HF_ENDPOINT=https://hf-mirror.com
AI写代码
python
运行
Linux 写入到~/.bashrc中:echo 'export HF_ENDPOINT="https://hf-mirror.com"' >> ~/.bashrc
AI写代码
python
运行
Windows Powershell$env:HF_ENDPOINT = "https://hf-mirror.com"
AI写代码
python
运行
Pythonimport os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
AI写代码
python
运行
3.1 下载模型(例子: gpt2)
./hfd.sh gpt2 --tool aria2c -x 4
AI写代码
python
运行
如果没有安装 aria2,则可以默认用 wget:./hfd.sh gpt2 
AI写代码
python
运行
3.2 下载数据集 (例子: wikitext )
./hfd.sh wikitext --dataset --tool aria2c -x 4
AI写代码
python
运行
方法四:使用环境变量(非侵入式)
非侵入式,能解决大部分情况。huggingface 工具链会获取HF_ENDPOINT环境变量来确定下载文件所用的网址,所以可以使用通过设置变量来解决。HF_ENDPOINT=https://hf-mirror.com python your_script.py
AI写代码
python
运行
不过有些数据集有内置的下载脚本,那就需要手动改一下脚本内的地址来实现了。————————————————版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/weixin_40959890/article/details/140319652
http://www.lryc.cn/news/2403587.html

相关文章:

  • SQL Server全局搜索:在整个数据库中查找特定值的高效方法
  • JVM 内存溢出 详解
  • Qt 5.12 上读取 .xlsx 文件(Windows 平台)
  • 虚拟机CentOS 7 网络连接显示“以太网(ens33,被拔出)“、有线已拔出、CentOS7不显示网络图标
  • Tailwind CSS 实战:基于 Kooboo 构建 AI 对话框页面(六):图片上传交互功能
  • 传统的将自然语言转化为嵌入向量的核心机制是:,将离散的语言符号转化为连续的语义向量,其核心依赖“上下文决定语义”的假设和神经网络的特征提取能力。
  • 【前端】每日一道面试题6:解释Promise.any和Promise.allSettled的使用场景及区别。
  • wordpress+woocommerce电商平台搭建方案的优势分析
  • 玄机-日志分析-IIS日志分析
  • IDEA:配置 Git 需要完成 Git 路径设置、账号认证以及仓库关联三个主要步骤
  • PHP 复制商品扩展实操:轻松切换一号通、99api ,实现商品复制功能
  • 【办公类-104-01】20250606通义万相50分一天用完,通义万相2.1专业版测试
  • Prompt Engineering Notes
  • C++课设:学生成绩管理系统
  • 制作个人Github学术主页
  • 【Linux内核】设备模型之udev技术详解
  • FineReport模板认证找不到模板
  • STM32实战:数字音频播放器开发指南
  • 豆包和deepseek 元宝 百度ai区别是什么
  • TomatoSCI数据分析实战:探索社交媒体成瘾
  • 网络安全厂商F5推出AI Gateway,化解大模型应用风险
  • pikachu靶场通关笔记16 CSRF关卡02-CSRF(POST)
  • 场景题-3
  • Java 类型参数 T、R 、 O 、K、V 、E 、? 区别
  • 中医的十问歌和脉象分类
  • C#封装HttpClient:HTTP请求处理最佳实践
  • 前端基础之《Vue(19)—状态管理》
  • 构建 MCP 服务器:第 4 部分 — 创建工具
  • 2.1 Windows编译环境介绍
  • 如何以 9 种方式将照片从手机传输到笔记本电脑