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
)