• huggingface上传或发布自己的模型(大语言模型LLM)


    创建huggingface账号和token

    https://huggingface.co/join注册huggingface账号,登录账号后,在https://huggingface.co/settings/tokens创建token,注意需要将token的类型设置为WRITE。

    安装必要软件包和初始化环境

    安装git lfs

    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
    sudo apt-get install git-lfs
    git lfs install
    
    • 1
    • 2
    • 3

    安装并登录huggingface-cli

    pip install huggingface_hub
    huggingface-cli login # 注意,这里需要输入你创建的token
    
    • 1
    • 2

    创建repo

    huggingface-cli repo create model_name
    
    • 1

    上传自己的模型

    首先git clone到本地

    git lfs install
    git clone https://huggingface.co/your_username/model_name
    
    • 1
    • 2

    然后将你的模型(checkpoint)保存到这个repo中。
    再进行git repo的上传。

    git add .
    git commit -m "commit from $USER"
    git push
    
    • 1
    • 2
    • 3

    其中,$USER指的是你配置的github的用户名或邮箱。关于如何配置,见https://blog.csdn.net/weixin_44022515/article/details/105967226。

    之后,再打开huggingface你模型地址的网页,即可看到自己发布的模型。(我上传的网速好慢,才1.6MB/s)

    更新

    执行git push很久后,终于成功上传,但是,出现了如下错误

    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.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    原来是,在他上传过程中,我闲着没事,去huggingface的repo里改了readme,导致版本出现更改。
    解决方法:

    git pull origin 分支名(如main)
    
    • 1

    这个时候,我们会发现,readme会更新到我们的服务器上。此时再执行git pull,便能成功,

  • 相关阅读:
    [ai笔记12] chatGPT技术体系梳理+本质探寻
    MyBatis工作原理
    jar 命令启动java 指定配置文件路径 jar如何启动
    基于51单片机水位检测自动抽水系统Proteus仿真
    PostgreSQL修炼之道笔记之准备篇(三)
    基于Advisor实现AOP
    攻击技术:命令和控制服务器(C2)是什么意思
    DAOS整体设计分析 (二)
    若依(ruoyi)管理系统(前后端分离版)本地运行教程(Windows)
    这么牛的代码 你能看懂吗
  • 原文地址:https://blog.csdn.net/weixin_44612221/article/details/136356734