本文主要是介绍本地模型一键上传modelscope,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ModelScope官网主页
- 存放大模型大文件
安装依赖
apt install git-lfs
pip3 install modelscope
上传
from modelscope.hub.api import HubApi
import os, jsonYOUR_ACCESS_TOKEN = '请从ModelScope个人中心->访问令牌获取'
MODEL_ID = "yourname/your_model_id"
LOCAL_MODEL_DIR = "my_model_dir"configuration = os.path.join(LOCAL_MODEL_DIR, "configuration.json")
with open(configuration, "w") as f:f.write(json.dumps({"framework":"Pytorch","task":"other"}))api = HubApi()
api.login(YOUR_ACCESS_TOKEN)
api.push_model(model_id=MODEL_ID , model_dir=LOCAL_MODEL_DIR
)
这篇关于本地模型一键上传modelscope的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!