linux系统下载huggingface文件教程

文章目录

准备工作

添加SSH Key

shell 复制代码
# 本地机器生成ssh key
# step1:安装git
brew install git 
# step2:验证git是否成功下载
git version
# git version 2.31.1
# step3:配置账号(如已经配置,直接跳到step5)
git config --global user.email "你的邮箱"
# 一路回车,就不需要每次记密码了
# step4:生成公共密钥
ssh-keygen -t rsa 
# step5:查看密钥
cat ~/.ssh/id_rsa.pub

复制上述生成的密钥在huggingface网站中配置,进入settings->SSH and GPG Keys->Add SSH Key,添加生成的密钥即可;查看ssh是否正常链接

python 复制代码
ssh -T [email protected]
# Hi XXX, welcome to Hugging Face.

然后安装LFS:

shell 复制代码
git lfs install

生成Access Token

进入settings->Access Tokens生成个人的Acces Token;

模型下载

公开模型下载(bert-base-chinese为例)

bert-base-chinese为例:

shell 复制代码
# 先下载基础文件,跳过大文件
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/google-bert/bert-base-chinese
# 然后逐个下载LFS大文件,记得把链接中的blob更改成resolve
sudo wget https://huggingface.co/bert-base-chinese/resolve/main/pytorch_model.bin  


非公开模型下载(Llama3为例)

权限申请

  • 进入官网申请权限,审核通过后即可进行模型下载,会收到审核通知的邮件,以Meta Llama3为例;
    • 官网申请:进入官网Meta-Llama ,填写基本信息,没有国内的选项,填写其他国家和学校,就能够申请成功;
    • huggingface申请:Meta-Llama-3-8B,填写对应表单,会得到通知邮件;

官网预训练模型下载

shell 复制代码
#  * 下载Llama3仓库:https://github.com/meta-llama/llama3
git clone [email protected]:meta-llama/llama3.git
# 进入llama3
cd llama3
# 运行download脚本
bash download.sh
# 填写邮箱或官网提供的链接
# Enter the URL from email: 你的私密链接
# 填写要下载的模型链接
# Enter the list of models to download without spaces (8B,8B-instruct,70B,70B-instruct), or press Enter for all: 你要下载的预训练模型

huggingface仓库下载

  • hugginface安全性升级后,下载必须通过Access Token进行认证
python 复制代码
# 跳过大文件下载基础文件
GIT_LFS_SKIP_SMUDGE=1 git clone https://你的名字:你的[email protected]/meta-llama/Meta-Llama-3-8B
# 逐个下载大文件
# 1. 账户密码的方式下载(已经不支持了)
# sudo wget https://你的名字:你的密码@huggingface.co/meta-llama/Meta-Llama-3-8B/resolve/main/model-00001-of-00004.safetensors
# 2. access token的方式,记得把blob改成resolve
wget --header="Authorization: Bearer 你的token" https://huggingface.co/meta-llama/Meta-Llama-3-8B/resolve/main/model-00001-of-00004.safetensors
相关推荐
王亭_6662 小时前
大模型Prompt提示词越狱相关知识
人工智能·chatgpt·大模型·prompt·deepseek
Nicolas8935 小时前
【大模型理论篇】关于生成式模型中联合分布概率学习必要性以及GPT是生成式模型的讨论
gpt·大模型·生成模型·生成式·判别式·监督生成式·无监督生成式
9命怪猫1 天前
DeepSeek底层揭秘——《推理时Scaling方法》技术对比浅析
人工智能·深度学习·机器学习·ai·大模型
小草cys1 天前
llama.cpp 和 vLLM 的详细对比分析
大模型·llama·vllm·deepseek
lovep11 天前
InternVideo2.5:Empowering Video MLLMs with Long and Rich Context Modeling
大模型·基础模型·视频理解·mllms·internvideo2.5
浩哥的技术博客2 天前
使用MetaGPT 创建智能体(1)入门
人工智能·大模型·智能体
Uncertainty!!2 天前
在huggingface上制作小demo
开发语言·python·机器学习·huggingface
日报初级开发工程师2 天前
记录-内网部署vllm分布式推理DeepSeekR1:70b
大模型
互联网架构小马2 天前
什么是大型语言模型(LLM)?哪个大模型更好用?
人工智能·ai·语言模型·自然语言处理·大模型·ai大模型
9命怪猫2 天前
AI大模型底层技术——结合 Prompt Engineering 的 LoRA
人工智能·深度学习·ai·大模型