huggingface上传或发布自己的模型(大语言模型LLM)

创建huggingface账号和token

在*https://huggingface.co/join*注册huggingface账号,登录账号后,在https://huggingface.co/settings/tokens创建token,注意需要将token的类型设置为WRITE。

安装必要软件包和初始化环境

安装git lfs

cpp 复制代码
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install

安装并登录huggingface-cli

cpp 复制代码
pip install huggingface_hub
huggingface-cli login # 注意,这里需要输入你创建的token

创建repo

cpp 复制代码
huggingface-cli repo create model_name

上传自己的模型

首先git clone到本地

cpp 复制代码
git lfs install
git clone https://huggingface.co/your_username/model_name

然后将你的模型(checkpoint)保存到这个repo中。

再进行git repo的上传。

cpp 复制代码
git add .
git commit -m "commit from $USER"
git push

其中,$USER指的是你配置的github的用户名或邮箱。关于如何配置,见https://blog.csdn.net/weixin_44022515/article/details/105967226。

之后,再打开huggingface你模型地址的网页,即可看到自己发布的模型。(我上传的网速好慢,才1.6MB/s)

更新

执行git push很久后,终于成功上传,但是,出现了如下错误

cpp 复制代码
error: failed to push some refs to 'https://huggingface.co/itpossible/JiuZhou'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原来是,在他上传过程中,我闲着没事,去huggingface的repo里改了readme,导致版本出现更改。

解决方法:

cpp 复制代码
git pull origin 分支名(如main)

这个时候,我们会发现,readme会更新到我们的服务器上。此时再执行git pull,便能成功,

相关推荐
Juchecar1 分钟前
如何理解“AI token 大宗商品化”?
人工智能
文火冰糖的硅基工坊3 分钟前
[人工智能-大模型-29]:大模型应用层技术栈 - 第二层:Prompt 编排层(Prompt Orchestration)
人工智能·大模型·prompt·copilot
大模型真好玩5 分钟前
LangGraph实战项目:从零手搓DeepResearch(三)——LangGraph多智能体搭建与部署
人工智能·langchain·mcp
飞哥数智坊8 分钟前
DeepSeek-OCR:用“看图”代替“读文”,一种更像人类的上下文压缩方式
人工智能·deepseek
L.fountain23 分钟前
强化学习2.2 MDP实践——Frozen lake
人工智能·强化学习
JJJJ_iii27 分钟前
【机器学习06】神经网络的实现、训练与向量化
人工智能·笔记·深度学习·神经网络·学习·机器学习·线性回归
倔强的石头10630 分钟前
AI协作天花板!CherryStudio让多模型协同像搭积木
人工智能·cpolar
IT_陈寒32 分钟前
Vite 3.0 性能优化实战:5个技巧让你的构建速度提升200% 🚀
前端·人工智能·后端
说私域1 小时前
从工具理性到价值共生:开源链动2+1模式、AI智能名片与S2B2C商城系统的社会连接重构研究
人工智能·重构·开源
heisd_11 小时前
OpenCV计算机视觉库
人工智能·opencv·计算机视觉