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

相关推荐
Are_You_Okkk_3 小时前
AI原生与外挂的区别:开源知识库的优势及优化方向
大数据·人工智能·开源
xinlianyq3 小时前
2026 边缘智能的崛起:端云协同架构下的“词元”调度艺术
人工智能·架构·api
2301_780789663 小时前
零信任架构在云安全落地过程中的最佳实践
服务器·人工智能·游戏·架构·零信任
人工智能AI技术3 小时前
OpenClaw.NET - 自托管、多模型、NativeAOT 的 Agent 平台
人工智能
IT_陈寒3 小时前
Vite的alias配置把我整不会了,原来是这个坑
前端·人工智能·后端
Dfreedom.3 小时前
【实战篇】图像分割-计算图中不同颜色区域的面积比
图像处理·人工智能·深度学习·计算机视觉·图像分割·otsu
TDengine (老段)3 小时前
TDengine IDMP 可视化 —— 定时报告
大数据·数据库·人工智能·物联网·时序数据库·tdengine·涛思数据
fenglllle4 小时前
使用AI能力编译ARM版本的截图软件
arm开发·人工智能
OpenVINO 中文社区4 小时前
OpenVINO™正式进入 llama.cpp:GGUF 模型现已支持 Intel CPU、GPU 与 NPU
人工智能·openvino·英特尔
ZKNOW甄知科技4 小时前
数智同行:甄知科技2026年Q1季度回顾
运维·服务器·人工智能·科技·程序人生·安全·自动化