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

相关推荐
青松@FasterAI22 分钟前
【程序员 NLP 入门】词嵌入 - 上下文中的窗口大小是什么意思? (★小白必会版★)
人工智能·自然语言处理
AIGC大时代38 分钟前
高效使用DeepSeek对“情境+ 对象 +问题“型课题进行开题!
数据库·人工智能·算法·aigc·智能写作·deepseek
硅谷秋水38 分钟前
GAIA-2:用于自动驾驶的可控多视图生成世界模型
人工智能·机器学习·自动驾驶
多巴胺与内啡肽.42 分钟前
深度学习--自然语言处理统计语言与神经语言模型
深度学习·语言模型·自然语言处理
偶尔微微一笑1 小时前
AI网络渗透kali应用(gptshell)
linux·人工智能·python·自然语言处理·编辑器
深度之眼1 小时前
2025时间序列都有哪些创新点可做——总结篇
人工智能·深度学习·机器学习·时间序列
晓数1 小时前
【硬核干货】JetBrains AI Assistant 干货笔记
人工智能·笔记·jetbrains·ai assistant
jndingxin1 小时前
OpenCV 图形API(60)颜色空间转换-----将图像从 YUV 色彩空间转换为 RGB 色彩空间函数YUV2RGB()
人工智能·opencv·计算机视觉
Sherlock Ma2 小时前
PDFMathTranslate:基于LLM的PDF文档翻译及双语对照的工具【使用教程】
人工智能·pytorch·语言模型·pdf·大模型·机器翻译·deepseek
知舟不叙2 小时前
OpenCV中的SIFT特征提取
人工智能·opencv·计算机视觉