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

相关推荐
子午1 分钟前
【卫星图像识别系统】Python+TensorFlow+Vue3+Django+人工智能+深度学习+卷积网络+resnet50算法
人工智能·python·深度学习
IT_陈寒8 分钟前
Python 3.12新特性实战:10个让你效率翻倍的代码优化技巧
前端·人工智能·后端
三选9 分钟前
AI时代下的个人成长论:如何获得新鲜量大的AI资讯?如何应用到自己的场景中?
人工智能
一点 内容12 分钟前
AI搜索前端打字机效果实现方案演进:从基础到智能化的技术跃迁
前端·人工智能
GISer_Jing14 分钟前
SEEConf大会分享——AI FOR FRONTEDN
前端·人工智能
进击切图仔35 分钟前
GraspNet 训练集下载、解释和整理
人工智能·pytorch·conda
sensen_kiss35 分钟前
INT301 Bio-computation 生物计算(神经网络)Pt.9 自我组织特征映射(Self-Organizing Fearure Map)
人工智能·深度学习·神经网络·机器学习
小毅&Nora36 分钟前
【人工智能】【AI外呼】 ③ 从骚扰电话到智能语音机器人:技术架构、行业生态与工程实践
人工智能·架构·智能外呼机器人
霍格沃兹测试开发学社-小明41 分钟前
测试开发技术路线全新升级:在云原生与AI时代构建核心竞争力
大数据·人工智能·云原生
jinxinyuuuus43 分钟前
TikTok Watermark Remover:用户行为模拟、动态Token认证与视频流的去噪
网络·人工智能·计算机视觉·架构