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

相关推荐
hie988946 分钟前
MATLAB锂离子电池伪二维(P2D)模型实现
人工智能·算法·matlab
晨同学03279 分钟前
opencv的颜色通道问题 & rgb & bgr
人工智能·opencv·计算机视觉
蓝婷儿19 分钟前
Python 机器学习核心入门与实战进阶 Day 3 - 决策树 & 随机森林模型实战
人工智能·python·机器学习
大千AI助手21 分钟前
PageRank:互联网的马尔可夫链平衡态
人工智能·机器学习·贝叶斯·mc·pagerank·条件概率·马尔科夫链
小和尚同志44 分钟前
Cline | Cline + Grok3 免费 AI 编程新体验
人工智能·aigc
我就是全世界1 小时前
TensorRT-LLM:大模型推理加速的核心技术与实践优势
人工智能·机器学习·性能优化·大模型·tensorrt-llm
.30-06Springfield1 小时前
决策树(Decision tree)算法详解(ID3、C4.5、CART)
人工智能·python·算法·决策树·机器学习
我不是哆啦A梦1 小时前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt
galaxylove1 小时前
Gartner发布塑造安全运营未来的关键 AI 自动化趋势
人工智能·安全·自动化
强哥之神2 小时前
英伟达发布 Llama Nemotron Nano 4B:专为边缘 AI 和科研任务优化的高效开源推理模型
人工智能·深度学习·语言模型·架构·llm·transformer·边缘计算