Skip to content

Latest commit

 

History

History
248 lines (174 loc) · 10.5 KB

README_zh_CN.md

File metadata and controls

248 lines (174 loc) · 10.5 KB

...

Machine Learning Model CI - 中文简介

codebeat badge

English Version系统简介安装指南快速使用更多例子详细教程加入我们文献引用版权许可

系统简介

Machine Learning Model CI 是一个云上一站式机器学习模型和服务运维平台,旨在解决模型训练完成后,到上线成为服务的”最后一公里问题“ -- 在训练得到模型和线上机器学习应用之间,构建了一个高度自动化的桥梁。

系统目前正处于快速迭代开发中,目前我们提供了如下功能,用户 1)可以注册模型到我们的系统,享受自动化的一揽子服务;2)也可以分别使用各个功能

  1. 模型管家. 该模块接受用户注册的原始训练模型,将其存储到一个中心化的数据库当中。并提供了若干API帮助用户在本地修改,检索,删除模型。
  2. 模型转换. 在收到用户的注册请求后,模型会被自动优化和转化为高性能的部署格式。目前支持的格式有Tensorflow SavedModel, ONNX, TorchScript, TensorRT。
  3. 模型解析评估. 为了保证高质量的线上服务,上线之前的模型需要大量的性能评估测试,一方面给模型性能调优提供参考,另一方面给线上服务设置提供参考。我们的评估模块可以对模型,硬件设施,软件设施进行基准评测,提供了p99延迟,吞吐等多维度的指标。
  4. 模型分发上线. 研究环境和生产环境一般是不同的,同时模型需要和模型推理服务引擎进行绑定进行服务。该模块将用户转换后的模型与各类引擎进行绑定,然后打包成docker服务,可以快速部署上线。
  5. 流程控制调度. 我们提供了一个调度器,一方面控制整个流程的自动化实施,另一方面会将各种模型转化、解析评估等任务,分发到较为空闲机器,提高集群的利用率,让整个流程更高效安全。

下面若干个功能正处于测试状态,马上会在下一个版本推出,读者可以到issue中和我们进行讨论。

  • 模型优化. 我们希望将模型量化、剪枝等加入到我们的自动化管道中。
  • 模型可视化微调优 我们希望用户可以零代码的查看和调优团队中的模型。

我们非常欢迎感兴趣的同学加入到我们的开发,请联系

huaizhen001 AT e.ntu.edu.sg

DEMO

下面两幅图分别展示了我们系统的网页前台和整体的工作流程。

Web frontend Workflow
drawing drawing

安装指南

环境准备

  • GNU/Linux 环境(推荐使用 Ubuntu 操作系统)
  • Docker
  • Docker Compose (可选, 适用于经由 docker 的安装)
  • TVM 以及其 Python 模块(可选)
  • TensorRT 以及其 Python API (可选)
  • Python >= 3.7

pip安装

# 从github上自动下载安装
pip install git+https://github.com/cap-ntu/ML-Model-CI.git@master

安装完成后,确保docker进程正在运行,就可以启动MLModelCI中心服务了。

modelci service init

CLI start service

或者停止MLModelCI中心服务:

modelci service stop

CLI stop service

Docker快速安装

CPU 版本

docker pull mlmodelci/mlmodelci:cpu

通过Docker Compose来启动一系列基本服务:

docker-compose -f ML-Model-CI/docker/docker-compose-cpu-modelhub.yml up -d

停止所有服务:

docker-compose -f ML-Model-CI/docker/docker-compose-cpu-modelhub.yml down

CUDA10.2 版本

docker pull mlmodelci/mlmodelci:cuda10.2-cudnn8

通过Docker Compose来启动一系列基本服务:

docker-compose -f ML-Model-CI/docker/docker-compose-gpu-modelhub.yml up -d

docker-compose start service

停止所有服务:

docker-compose -f ML-Model-CI/docker/docker-compose-gpu-modelhub.yml down

docker-compose stop service

快速使用

我们为用户提供了三种使用MLModelCI的方式:CLI使用、运行Python脚本和Web界面。

1. CLI使用

# 利用模型管家快速发布模型到系统中
modelci@modelci-PC:~$ modelci modelhub publish -f example/resnet50.yml
{'data': {'id': ['60746e4bc3d5598e0e7a786d']}, 'status': True}

用户可以从 WIKI 中获取更多CLI的用法。

2. 运行Python脚本

from modelci.hub.converter import convert
from modelci.types.bo import IOShape

# 系统会自动启动模型转换,用户也可以手工调用该函数
convert(
    '<torch model>',
    src_framework='pytorch', 
    dst_framework='onnx',
    save_path='<path to export onnx model>', 
    inputs=[IOShape([-1, 3, 224, 224], dtype=float)], 
    outputs=[IOShape([-1, 1000], dtype=float)], 
    opset=11)

3. Web界面

如果用户是通过pip安装的MLModelCI, 则需要手动启动前端Web界面。

# 到前端代码所在文件夹
cd frontend
# 安装npm依赖
yarn install
# 启动前端
yarn start

访问 http://localhost:3333 ,就可以进入web界面的首页。

更多例子

详细教程

用户可以通过我们的文档,详细理解MLModelCI

加入我们

请参考 代码贡献指南 来加入我们的开发.

文献引用

如果您使用了我们系统的代码,我们非常感谢您可以引用我们的论文

@inproceedings{10.1145/3394171.3414535,
  author = {Zhang, Huaizheng and Li, Yuanming and Huang, Yizheng and Wen, Yonggang and Yin, Jianxiong and Guan, Kyle},
  title = {MLModelCI: An Automatic Cloud Platform for Efficient MLaaS},
  year = {2020},
  url = {https://doi.org/10.1145/3394171.3414535},
  doi = {10.1145/3394171.3414535},
  booktitle = {Proceedings of the 28th ACM International Conference on Multimedia},
  pages = {4453–4456},
  numpages = {4},
  location = {Seattle, WA, USA},
  series = {MM '20}
}

版权许可

   Copyright 2021 Nanyang Technological University, Singapore

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.