You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README_CN.md 5.3 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # MindSpore Serving
  2. [View English](./README.md)
  3. <!-- TOC -->
  4. - [MindSpore Serving](#mindspore-serving)
  5. - [概述](#概述)
  6. - [安装](#安装)
  7. - [安装Serving](#安装serving)
  8. - [配置环境变量](#配置环境变量)
  9. - [快速入门](#快速入门)
  10. - [文档](#文档)
  11. - [开发者教程](#开发者教程)
  12. - [社区](#社区)
  13. - [治理](#治理)
  14. - [交流](#交流)
  15. - [贡献](#贡献)
  16. - [版本说明](#版本说明)
  17. - [许可证](#许可证)
  18. <!-- /TOC -->
  19. ## 概述
  20. MindSpore Serving是一个轻量级、高性能的服务模块,旨在帮助MindSpore开发者在生产环境中高效部署在线推理服务。当用户使用MindSpore完成模型训练后,导出MindSpore模型,即可使用MindSpore Serving创建该模型的推理服务。
  21. MindSpore Serving架构:
  22. 当前MindSpore Serving服务节点分为client,master和worker。client为客户端节点,用户可以直接通过gRPC或RESTful接口方式下发推理服务命令。执行机worker部署了模型服务Servable,这里的Servable可以是单个模型,也可以是多个模型的组合,一个Servable可以通过提供多种方法来提供不同的服务。master节点用来管理所有的执行机worker及其部署的模型信息,并进行任务管理与分发。master和worker可以部署在一个进程中,也可以部署在不同进程中。当前client和master不依赖特定硬件平台,worker节点仅支持Ascend 310和Ascend 910平台,后续会逐步支持GPU和CPU场景。
  23. <img src="docs/architecture.png" alt="MindSpore Architecture" width="600"/>
  24. MindSpore Serving提供以下功能:
  25. - 支持客户端gRPC和RESTful接口。
  26. - 支持组装模型的前处理和后处理。
  27. - 支持batch功能,多实例请求会被拆分组合以满足模型`batch size`需要。
  28. - 提供客户端python简易接口。
  29. ## 安装
  30. MindSpore Serving依赖MindSpore训练推理框架,安装完[MindSpore](https://gitee.com/mindspore/mindspore#%E5%AE%89%E8%A3%85) ,再安装MindSpore Serving。
  31. ### 安装Serving
  32. 使用pip命令安装,安装方式如下:
  33. - 请从MindSpore Serving下载页面下载并安装whl包。
  34. ```python
  35. pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.0/Serving/ascend/ubuntu_x86/mindspore_serving-1.1.0-cp37-cp37m-linux_x86_64.whl
  36. ```
  37. - 源码编译安装。
  38. 下载[源码](https://gitee.com/mindspore/serving),下载后进入`serving`目录。
  39. 方式一,指定Serving依赖的已安装或编译的MindSpore包路径,安装Serving:
  40. ```shell
  41. sh build.sh -p $MINDSPORE_LIB_PATH
  42. ```
  43. 其中,`build.sh`为`serving`目录下的编译脚本文件,`$MINDSPORE_LIB_PATH`为MindSpore软件包的安装路径下的`lib`路径,例如,`softwarepath/mindspore/lib`,该路径包含MindSpore运行依赖的库文件。
  44. 方式二,直接编译Serving,编译时会配套编译MindSpore的包,需要配置MindSpore编译时的[环境变量](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_source.md#配置环境变量) :
  45. ```shell
  46. # ascend 310
  47. sh build.sh -e d -V 310
  48. # ascend 910
  49. sh build.sh -e ascend
  50. ```
  51. 其中,`build.sh`为`serving`目录下的编译脚本文件,编译完后,在`serving/build/package/`目录下找到whl安装包进行安装:
  52. ```python
  53. pip install mindspore_serving-1.1.0-cp37-cp37m-linux_x86_64.whl
  54. ```
  55. 执行以下命令,验证安装结果。导入python模块不报错即安装成功:
  56. ```python
  57. from mindspore_serving import master
  58. from mindspore_serving import worker
  59. ```
  60. ### 配置环境变量
  61. MindSpore Serving运行需要配置以下环境变量:
  62. - MindSpore Serving依赖MindSpore正确运行,运行MindSpore需要完成[环境变量配置](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_pip.md#%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F)。
  63. - MindSpore Serving依赖MindSpore库文件,需指定MindSpore软件包的编译或安装路径下的`lib`路径到LD_LIBRARY_PATH。
  64. ```shell
  65. export LD_LIBRARY_PATH=$MINDSPORE_LIB_PATH:${LD_LIBRARY_PATH}
  66. ```
  67. ## 快速入门
  68. 以一个简单的[Add网络示例](https://www.mindspore.cn/tutorial/inference/zh-CN/serving_example.html),演示MindSpore Serving如何使用。
  69. ## 文档
  70. ### 开发者教程
  71. - [基于gRPC接口访问MindSpore Serving服务](https://www.mindspore.cn/tutorial/inference/zh-CN/serving_grpc.html)
  72. - [基于RESTful接口访问MindSpore Serving服务](https://www.mindspore.cn/tutorial/inference/zh-CN/serving_restful.html)
  73. - [通过配置模型提供Servable](https://www.mindspore.cn/tutorial/inference/zh-CN/serving_model.html)
  74. 有关安装指南、教程和API的更多详细信息,请参阅[用户文档](https://gitee.com/mindspore/serving/tree/master/docs)。
  75. ## 社区
  76. ### 治理
  77. 查看MindSpore如何进行[开放治理](https://gitee.com/mindspore/community/blob/master/governance.md)。
  78. ### 交流
  79. - [MindSpore Slack](https://join.slack.com/t/mindspore/shared_invite/zt-dgk65rli-3ex4xvS4wHX7UDmsQmfu8w) 开发者交流平台。
  80. ## 贡献
  81. 欢迎参与贡献。
  82. ## 版本说明
  83. 版本说明请参阅[RELEASE](RELEASE.md)。
  84. ## 许可证
  85. [Apache License 2.0](LICENSE)

A lightweight and high-performance service module that helps MindSpore developers efficiently deploy online inference services in the production environment.