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.md 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # MindSpore Serving
  2. [查看中文](./README_CN.md)
  3. <!-- TOC -->
  4. - [MindSpore Serving](#mindspore-serving)
  5. - [Overview](#overview)
  6. - [Installation](#installation)
  7. - [Installing Serving](#installing-serving)
  8. - [Configuring Environment Variables](#configuring-environment-variables)
  9. - [Quick Start](#quick-start)
  10. - [Documents](#documents)
  11. - [Developer Guide](#developer-guide)
  12. - [Community](#community)
  13. - [Governance](#governance)
  14. - [Communication](#communication)
  15. - [Contributions](#contributions)
  16. - [Release Notes](#release-notes)
  17. - [License](#license)
  18. <!-- /TOC -->
  19. ## Overview
  20. MindSpore Serving is a lightweight and high-performance service module that helps MindSpore developers efficiently deploy online inference services in the production environment. After completing model training on MindSpore, you can export the MindSpore model and use MindSpore Serving to create an inference service for the model.
  21. MindSpore Serving architecture:
  22. Currently, the MindSpore Serving nodes include client, master, and worker. On a client node, you can directly deliver inference service commands through the gRPC or RESTful API. Servable model service is deployed on a worker node. Servable indicates a single model or a combination of multiple models and provides different services in various methods. A master node manages all worker nodes and their model information, as well as managing and distributing tasks. The master and worker nodes can be deployed in the same process or in different processes. Currently, the client and master nodes do not depend on specific hardware platforms. The worker node supports only the Ascend 310 and Ascend 910 platforms. GPUs and CPUs will be supported in the future.
  23. <img src="docs/architecture.png" alt="MindSpore Architecture" width="600"/>
  24. MindSpore Serving provides the following functions:
  25. - gRPC and RESTful APIs on clients
  26. - Pre-processing and post-processing of assembled models
  27. - Batch. Multiple instance requests are split and combined to meet the `batch size` requirement of the model.
  28. - Simple Python APIs on clients
  29. ## Installation
  30. MindSpore Serving depends on the MindSpore training and inference framework. Therefore, install [MindSpore](https://gitee.com/mindspore/mindspore/blob/master/README.md#installation) and then MindSpore Serving.
  31. ### Installing Serving
  32. Use the pip command to install Serving. Perform the following steps:
  33. - Download the .whl package from the [MindSpore Serving page](https://www.mindspore.cn/versions/en) and install it.
  34. ```python
  35. pip install mindspore_serving-{version}-cp37-cp37m-linux_{arch}.whl
  36. ```
  37. > - `{version}` denotes the version of MindSpore Serving. For example, when you are downloading MindSpore Serving 1.1.0, `{version}` should be 1.1.0.
  38. > - `{arch}` denotes the system architecture. For example, the Linux system you are using is x86 architecture 64-bit, `{arch}` should be `x86_64`. If the system is ARM architecture 64-bit, then it should be `aarch64`.
  39. - Install Serving using the source code.
  40. Download the [source code](https://gitee.com/mindspore/serving) and go to the `serving` directory.
  41. Method 1: Specify the path of the installed or built MindSpore package on which Serving depends and install Serving.
  42. ```shell
  43. sh build.sh -p $MINDSPORE_LIB_PATH
  44. ```
  45. In the preceding information, `build.sh` is the build script file in the `serving` directory, and `$MINDSPORE_LIB_PATH` is the `lib` directory in the installation path of the MindSpore software package, for example, `softwarepath/mindspore/lib`. This path contains the library files on which MindSpore depends.
  46. Method 2: Directly build Serving. The MindSpore package is built together with Serving. You need to configure the [environment variables](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_source_en.md#configuring-environment-variables) for MindSpore building.
  47. ```shell
  48. # Ascend 310
  49. sh build.sh -e ascend -V 310
  50. # Ascend 910
  51. sh build.sh -e ascend -V 910
  52. ```
  53. In the preceding information, `build.sh` is the build script file in the `serving` directory. After the build is complete, find the .whl installation package of MindSpore in the `serving/third_party/mindspore/build/package/` directory and install it.
  54. ```python
  55. pip install mindspore_ascend-{version}-cp37-cp37m-linux_{arch}.whl
  56. ```
  57. Find the .whl installation package of Serving in the `serving/build/package/` directory and install it.
  58. ```python
  59. pip install mindspore_serving-{version}-cp37-cp37m-linux_{arch}.whl
  60. ```
  61. Run the following commands to verify the installation. Import the Python module. If no error is reported, the installation is successful.
  62. ```python
  63. from mindspore_serving import master
  64. from mindspore_serving import worker
  65. ```
  66. ### Configuring Environment Variables
  67. To run MindSpore Serving, configure the following environment variables:
  68. - MindSpore Serving depends on MindSpore. You need to configure [environment variables](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_source_en.md#configuring-environment-variables) to run MindSpore.
  69. - MindSpore Serving depends on the MindSpore library file. You need to specify the `lib` path in the build or installation path of the MindSpore software package to LD_LIBRARY_PATH. For the meaning of `$MINDSPORE_LIB_PATH`, see [MindSpore-based Inference Service Deployment](https://gitee.com/mindspore/serving/blob/master/README.md#installation).
  70. ```shell
  71. export LD_LIBRARY_PATH=$MINDSPORE_LIB_PATH:${LD_LIBRARY_PATH}
  72. ```
  73. ## Quick Start
  74. [MindSpore-based Inference Service Deployment](https://www.mindspore.cn/tutorial/inference/en/master/serving_example.html) is used to demonstrate how to use MindSpore Serving.
  75. ## Documents
  76. ### Developer Guide
  77. - [gRPC-based MindSpore Serving Access](https://www.mindspore.cn/tutorial/inference/en/master/serving_grpc.html)
  78. - [RESTful-based MindSpore Serving Access](https://www.mindspore.cn/tutorial/inference/en/master/serving_restful.html)
  79. - [Servable Provided Through Model Configuration](https://www.mindspore.cn/tutorial/inference/en/master/serving_model.html)
  80. For more details about the installation guide, tutorials, and APIs, see [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html).
  81. ## Community
  82. ### Governance
  83. [MindSpore Open Governance](https://gitee.com/mindspore/community/blob/master/governance.md)
  84. ### Communication
  85. - [MindSpore Slack](https://join.slack.com/t/mindspore/shared_invite/zt-dgk65rli-3ex4xvS4wHX7UDmsQmfu8w) developer communication platform
  86. ## Contributions
  87. Welcome to MindSpore contribution.
  88. ## Release Notes
  89. [RELEASE](RELEASE.md)
  90. ## License
  91. [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.