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,便能成功,

相关推荐
宝贝儿好8 小时前
【LLM】第三章:项目实操案例:智能输入法项目
人工智能·python·深度学习·算法·机器人
AI创界者8 小时前
【首发】LTX-2.3-10Eros 视频生成本地化部署教程:8G显存流畅运行,支持RTX 50系列(附一键整合包)
人工智能
Elastic 中国社区官方博客9 小时前
Elastic 的 AI agent skills
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
容智信息9 小时前
AI Agent(智能体)的输出格式应该从 Markdown 转向 HTML吗?
前端·人工智能·rust·编辑器·html·prompt
学习论之费曼学习法9 小时前
AI 入门 30 天挑战 - Day 28 - 前沿技术概览
人工智能
陕西字符9 小时前
2026 西安小微企业地图与 AI 问答排名优化:专业技术指南与落地方案
大数据·人工智能
TENSORTEC腾视科技9 小时前
腾视科技AI大模型应用:提效、破局与落地,重塑智能新生态
人工智能·科技·安全·ai·ai大模型·无人叉车及智能调度系统解决方案
阿里云大数据AI技术9 小时前
破解 AI 搜索“效果与成本”双重困境:阿里云 Elasticsearch 向量混合检索最佳实践揭秘
人工智能·elasticsearch
仙女修炼史9 小时前
视觉CNN常用基础技术来源:UberNet
人工智能·神经网络·cnn
ishangy9 小时前
皮带撕裂早期特征提取:AI摄像机+深度学习在港口的应用
人工智能·深度学习·智慧港口·港口皮带ai识别·皮带检测识别