ML板客户端库
python-mlboardclient的Python项目详细描述
python mlboardclient
用于交互ML板组件的Python库。
安装
来自Pypi
pip install python-mlboardclient
来自Github(Fresh Master Branch)
pip install 'git+https://github.com/kuberlab/python-mlboardclient.git'
用法
frommlboardclient.apiimportclient# Default url is http://mlboard-v2.kuberlab:8082/api/v2# No need to pass any url if instantiate client from ml-project (Jupyter/Task)ml=client.Client()apps=ml.apps.list()[<mlboardclient.api.v2.apps.Appobjectat0x7f0b554b5f90>]app=apps[0]# Get tasks from configapp.tasks[<Taskname=modelbuild=Nonestatus=undefined>]task=app.tasks[0]# Run & wait tasktask.run()<Taskname=modelbuild=4status=Succeeded># Get tasks from APIapp.get_tasks()[<Taskname=modelbuild=1status=Failed>,<Taskname=modelbuild=2status=Failed>,<Taskname=modelbuild=3status=Failed>,<Taskname=modelbuild=4status=Succeeded>]
模型上传
ml.model_upload('my-model','1.0.0','/model/dir')# If the model uploading is not executing in scope of project task,# need to specify workspace_name and project_name explicitly:ml.model_upload('my-model','1.0.0','/model/dir',workspace_name='demo',project_name='test-project)# Wait until model is being uploaded.