codespace、huggingface及魔塔社区使用

 上传模型到自己创建的huggingface中

 1,创建自己的登录token:

git config --global credential.helper store
huggingface-cli login 

使用 登录命令进行登录,登录过程中输入刚刚创建的token即可

2、创建自己的huggingface文件夹

cd /workspaces/codespaces-jupyter

#intern_study_L0_4就是model_name
huggingface-cli repo create intern_study_L0_4

# 克隆到本地 your_huggingface_name 注意替换成你自己的
git clone https://huggingface.co/{your_huggingface_name}/intern_study_L0_4

然后将本地的模型文件等通过以下命令上传到对应的文件中:

cd intern_study_L0_4
git add .
git commit -m "add:intern_study_L0_4"
git push

结果如下:

一般模型文件都比较大:一般借助git-lfs,如:

# 确保安装git-lfs 保证大文件的正常下载
apt-get install git-lfs
git lfs install
# clone 仓库
git clone https://modelers.cn/Intern/internlm2_5-1_8b-chat.git

2.2魔塔社区:

魔塔社区与huggingface类似,都是模型共享的平台,其使用也与huggingface类似

为魔塔社区的模型创建一个环境,指定安装目录

# 激活环境
conda activate /root/share/pre_envs/pytorch2.1.2cu12.1

# 安装 modelscope
pip install modelscope -t /root/env/maas
pip install numpy==1.26.0  -t /root/env/maas
pip install packaging -t /root/env/maas
  • internlm2_5-7b-chat 考虑到7B的模型文件比较大,这里我们先采用modelscope的cli工具(当然hugging face也有)来下载指定文件,在命令行输入以下命令
modelscope download \
    --model 'Shanghai_AI_Laboratory/internlm2_5-7b-chat' \
    tokenizer.json config.json model.safetensors.index.json \
    --local_dir '/root/ms_demo'

魔塔上传文件的方式:

魔搭社区类似HF,也有一套创建模型的界面。不同的是,它具有审核机制,当符合它的社区规范时才会被公开。那么当上传正常的模型文件后,审核一般就会通过了。

上传文件的方法可以直接通过平台添加文件,也可以通过git下载模型后进行修改和上传文件

#Git模型下载
git clone https://www.modelscope.cn/<your_username>/<your_model>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值