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

相关推荐
sali-tec1 小时前
C# 基于halcon的视觉工作流-章66 四目匹配
开发语言·人工智能·数码相机·算法·计算机视觉·c#
这张生成的图像能检测吗1 小时前
(论文速读)ParaDiffusion:基于信息扩散模型的段落到图像生成
人工智能·机器学习·计算机视觉·文生图·图像生成·视觉语言模型
新程记1 小时前
2025年,上海CAIE认证报考指南:把握AI机遇的实用起点
人工智能·百度
unicrom_深圳市由你创科技2 小时前
汽修AI智能体V1.0——从模型微调到应用部署
人工智能
路边草随风2 小时前
milvus向量数据库使用尝试
人工智能·python·milvus
irizhao2 小时前
基于深度学习的智能停车场系统设计与实现
人工智能·深度学习
九河云3 小时前
华为云 ECS 弹性伸缩技术:应对业务峰值的算力动态调度策略
大数据·服务器·人工智能·物联网·华为云
IT空门:门主3 小时前
Spring AI的教程,持续更新......
java·人工智能·spring·spring ai
美狐美颜SDK开放平台4 小时前
美颜sdk是什么?如何将美颜SDK接入安卓/iOS直播平台?
人工智能·美颜sdk·直播美颜sdk·美颜api·美狐美颜sdk
AI营销资讯站4 小时前
AI营销内容生产:哪些平台支持全球多语言内容同步生产?
大数据·人工智能