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 16 kB

5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. ![MindSpore Logo](https://gitee.com/mindspore/mindspore/raw/master/docs/MindSpore-logo.png "MindSpore logo")
  2. [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mindspore.svg)](https://pypi.org/project/mindspore)
  3. [![PyPI](https://badge.fury.io/py/mindspore.svg)](https://badge.fury.io/py/mindspore)
  4. [![Downloads](https://pepy.tech/badge/mindspore)](https://pepy.tech/project/mindspore)
  5. [![DockerHub](https://img.shields.io/docker/pulls/mindspore/mindspore-cpu.svg)](https://hub.docker.com/r/mindspore/mindspore-cpu)
  6. [![LICENSE](https://img.shields.io/github/license/mindspore-ai/mindspore.svg?style=flat-square)](https://github.com/mindspore-ai/mindspore/blob/master/LICENSE)
  7. [![Slack](https://img.shields.io/badge/slack-chat-green.svg?logo=slack)](https://join.slack.com/t/mindspore/shared_invite/zt-dgk65rli-3ex4xvS4wHX7UDmsQmfu8w)
  8. [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://gitee.com/mindspore/mindspore/pulls)
  9. [查看中文](./README_CN.md)
  10. <!-- TOC -->
  11. - [What Is MindSpore](#what-is-mindspore)
  12. - [Automatic Differentiation](#automatic-differentiation)
  13. - [Automatic Parallel](#automatic-parallel)
  14. - [Installation](#installation)
  15. - [Pip mode method installation](#pip-mode-method-installation)
  16. - [Source code compilation installation](#source-code-compilation-installation)
  17. - [Docker Image](#docker-image)
  18. - [Quickstart](#quickstart)
  19. - [Docs](#docs)
  20. - [Community](#community)
  21. - [Governance](#governance)
  22. - [Communication](#communication)
  23. - [Contributing](#contributing)
  24. - [Maintenance phases](#maintenance-phases)
  25. - [Maintenance status](#maintenance-status)
  26. - [Release Notes](#release-notes)
  27. - [License](#license)
  28. <!-- /TOC -->
  29. ## What Is MindSpore
  30. MindSpore is a new open source deep learning training/inference framework that
  31. could be used for mobile, edge and cloud scenarios. MindSpore is designed to
  32. provide development experience with friendly design and efficient execution for
  33. the data scientists and algorithmic engineers, native support for Ascend AI
  34. processor, and software hardware co-optimization. At the meantime MindSpore as
  35. a global AI open source community, aims to further advance the development and
  36. enrichment of the AI software/hardware application ecosystem.
  37. <img src="https://gitee.com/mindspore/mindspore/raw/master/docs/MindSpore-architecture.png" alt="MindSpore Architecture" width="600"/>
  38. For more details please check out our [Architecture Guide](https://www.mindspore.cn/doc/note/en/master/design/mindspore/architecture.html).
  39. ### Automatic Differentiation
  40. There are currently three automatic differentiation techniques in mainstream deep learning frameworks:
  41. - **Conversion based on static compute graph**: Convert the network into a static data flow graph at compile time, then turn the chain rule into a data flow graph to implement automatic differentiation.
  42. - **Conversion based on dynamic compute graph**: Record the operation trajectory of the network during forward execution in an operator overloaded manner, then apply the chain rule to the dynamically generated data flow graph to implement automatic differentiation.
  43. - **Conversion based on source code**: This technology is evolving from the functional programming framework and performs automatic differential transformation on the intermediate expression (the expression form of the program during the compilation process) in the form of just-in-time compilation (JIT), supporting complex control flow scenarios, higher-order functions and closures.
  44. TensorFlow adopted static calculation diagrams in the early days, whereas PyTorch used dynamic calculation diagrams. Static maps can utilize static compilation technology to optimize network performance, however, building a network or debugging it is very complicated. The use of dynamic graphics is very convenient, but it is difficult to achieve extreme optimization in performance.
  45. But MindSpore finds another way, automatic differentiation based on source code conversion. On the one hand, it supports automatic differentiation of automatic control flow, so it is quite convenient to build models like PyTorch. On the other hand, MindSpore can perform static compilation optimization on neural networks to achieve great performance.
  46. <img src="https://gitee.com/mindspore/mindspore/raw/master/docs/Automatic-differentiation.png" alt="Automatic Differentiation" width="600"/>
  47. The implementation of MindSpore automatic differentiation can be understood as the symbolic differentiation of the program itself. Because MindSpore IR is a functional intermediate expression, it has an intuitive correspondence with the composite function in basic algebra. The derivation formula of the composite function composed of arbitrary basic functions can be derived. Each primitive operation in MindSpore IR can correspond to the basic functions in basic algebra, which can build more complex flow control.
  48. ### Automatic Parallel
  49. The goal of MindSpore automatic parallel is to build a training method that combines data parallelism, model parallelism, and hybrid parallelism. It can automatically select a least cost model splitting strategy to achieve automatic distributed parallel training.
  50. <img src="https://gitee.com/mindspore/mindspore/raw/master/docs/Automatic-parallel.png" alt="Automatic Parallel" width="600"/>
  51. At present, MindSpore uses a fine-grained parallel strategy of splitting operators, that is, each operator in the figure is split into a cluster to complete parallel operations. The splitting strategy during this period may be very complicated, but as a developer advocating Pythonic, you don't need to care about the underlying implementation, as long as the top-level API compute is efficient.
  52. ## Installation
  53. ### Pip mode method installation
  54. MindSpore offers build options across multiple backends:
  55. | Hardware Platform | Operating System | Status |
  56. | :---------------- | :--------------- | :----- |
  57. | Ascend910 | Ubuntu-x86 | ✔️ |
  58. | | Ubuntu-aarch64 | ✔️ |
  59. | | EulerOS-aarch64 | ✔️ |
  60. | | CentOS-x86 | ✔️ |
  61. | | CentOS-aarch64 | ✔️ |
  62. | GPU CUDA 10.1 | Ubuntu-x86 | ✔️ |
  63. | CPU | Ubuntu-x86 | ✔️ |
  64. | | Ubuntu-aarch64 | ✔️ |
  65. | | Windows-x86 | ✔️ |
  66. For installation using `pip`, take `CPU` and `Ubuntu-x86` build version as an example:
  67. 1. Download whl from [MindSpore download page](https://www.mindspore.cn/versions/en), and install the package.
  68. ```bash
  69. pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.2.0-rc1/MindSpore/cpu/ubuntu_x86/mindspore-1.2.0rc1-cp37-cp37m-linux_x86_64.whl
  70. ```
  71. 2. Run the following command to verify the install.
  72. ```python
  73. import numpy as np
  74. import mindspore.context as context
  75. import mindspore.nn as nn
  76. from mindspore import Tensor
  77. from mindspore.ops import operations as P
  78. context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
  79. class Mul(nn.Cell):
  80. def __init__(self):
  81. super(Mul, self).__init__()
  82. self.mul = P.Mul()
  83. def construct(self, x, y):
  84. return self.mul(x, y)
  85. x = Tensor(np.array([1.0, 2.0, 3.0]).astype(np.float32))
  86. y = Tensor(np.array([4.0, 5.0, 6.0]).astype(np.float32))
  87. mul = Mul()
  88. print(mul(x, y))
  89. ```
  90. ```text
  91. [ 4. 10. 18.]
  92. ```
  93. Use pip mode method to install MindSpore in different environments. Refer to the following documents.
  94. - [Using pip mode method to install MindSpore in Ascend environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_pip_en.md)
  95. - [Using pip mode method to install MindSpore in GPU environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_gpu_install_pip_en.md)
  96. - [Using pip mode method to install MindSpore in CPU environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_cpu_install_pip_en.md)
  97. ### Source code compilation installation
  98. Use the source code compilation method to install MindSpore in different environments. Refer to the following documents.
  99. - [Using the source code compilation method to install MindSpore in Ascend environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_ascend_install_source_en.md)
  100. - [Using the source code compilation method to install MindSpore in GPU environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_gpu_install_source_en.md)
  101. - [Using the source code compilation method to install MindSpore in CPU environment](https://gitee.com/mindspore/docs/blob/master/install/mindspore_cpu_install_source_en.md)
  102. ### Docker Image
  103. MindSpore docker image is hosted on [Docker Hub](https://hub.docker.com/r/mindspore),
  104. currently the containerized build options are supported as follows:
  105. | Hardware Platform | Docker Image Repository | Tag | Description |
  106. | :---------------- | :---------------------- | :-- | :---------- |
  107. | CPU | `mindspore/mindspore-cpu` | `x.y.z` | Production environment with pre-installed MindSpore `x.y.z` CPU release. |
  108. | | | `devel` | Development environment provided to build MindSpore (with `CPU` backend) from the source, refer to <https://www.mindspore.cn/install/en> for installation details. |
  109. | | | `runtime` | Runtime environment provided to install MindSpore binary package with `CPU` backend. |
  110. | GPU | `mindspore/mindspore-gpu` | `x.y.z` | Production environment with pre-installed MindSpore `x.y.z` GPU release. |
  111. | | | `devel` | Development environment provided to build MindSpore (with `GPU CUDA10.1` backend) from the source, refer to <https://www.mindspore.cn/install/en> for installation details. |
  112. | | | `runtime` | Runtime environment provided to install MindSpore binary package with `GPU CUDA10.1` backend. |
  113. | Ascend | <center>&mdash;</center> | <center>&mdash;</center> | Coming soon. |
  114. > **NOTICE:** For GPU `devel` docker image, it's NOT suggested to directly install the whl package after building from the source, instead we strongly RECOMMEND you transfer and install the whl package inside GPU `runtime` docker image.
  115. - CPU
  116. For `CPU` backend, you can directly pull and run the latest stable image using the below command:
  117. ```bash
  118. docker pull mindspore/mindspore-cpu:1.1.0
  119. docker run -it mindspore/mindspore-cpu:1.1.0 /bin/bash
  120. ```
  121. - GPU
  122. For `GPU` backend, please make sure the `nvidia-container-toolkit` has been installed in advance, here are some install guidelines for `Ubuntu` users:
  123. ```bash
  124. DISTRIBUTION=$(. /etc/os-release; echo $ID$VERSION_ID)
  125. curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
  126. curl -s -L https://nvidia.github.io/nvidia-docker/$DISTRIBUTION/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list
  127. sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-docker2
  128. sudo systemctl restart docker
  129. ```
  130. Then edit the file daemon.json:
  131. ```bash
  132. $ vim /etc/docker/daemon.json
  133. {
  134. "runtimes": {
  135. "nvidia": {
  136. "path": "nvidia-container-runtime",
  137. "runtimeArgs": []
  138. }
  139. }
  140. }
  141. ```
  142. Restart docker again:
  143. ```bash
  144. sudo systemctl daemon-reload
  145. sudo systemctl restart docker
  146. ```
  147. Then you can pull and run the latest stable image using the below command:
  148. ```bash
  149. docker pull mindspore/mindspore-gpu:1.1.0
  150. docker run -it -v /dev/shm:/dev/shm --runtime=nvidia --privileged=true mindspore/mindspore-gpu:1.1.0 /bin/bash
  151. ```
  152. To test if the docker image works, please execute the python code below and check the output:
  153. ```python
  154. import numpy as np
  155. import mindspore.context as context
  156. from mindspore import Tensor
  157. from mindspore.ops import functional as F
  158. context.set_context(mode=context.PYNATIVE_MODE, device_target="GPU")
  159. x = Tensor(np.ones([1,3,3,4]).astype(np.float32))
  160. y = Tensor(np.ones([1,3,3,4]).astype(np.float32))
  161. print(F.tensor_add(x, y))
  162. ```
  163. ```text
  164. [[[ 2. 2. 2. 2.],
  165. [ 2. 2. 2. 2.],
  166. [ 2. 2. 2. 2.]],
  167. [[ 2. 2. 2. 2.],
  168. [ 2. 2. 2. 2.],
  169. [ 2. 2. 2. 2.]],
  170. [[ 2. 2. 2. 2.],
  171. [ 2. 2. 2. 2.],
  172. [ 2. 2. 2. 2.]]]
  173. ```
  174. If you want to learn more about the building process of MindSpore docker images,
  175. please check out [docker](https://gitee.com/mindspore/mindspore/blob/master/docker/README.md) repo for the details.
  176. ## Quickstart
  177. See the [Quick Start](https://www.mindspore.cn/tutorial/training/en/master/quick_start/quick_start.html)
  178. to implement the image classification.
  179. ## Docs
  180. More details about installation guide, tutorials and APIs, please see the
  181. [User Documentation](https://gitee.com/mindspore/docs).
  182. ## Community
  183. ### Governance
  184. Check out how MindSpore Open Governance [works](https://gitee.com/mindspore/community/blob/master/governance.md).
  185. ### Communication
  186. - [MindSpore Slack](https://join.slack.com/t/mindspore/shared_invite/zt-dgk65rli-3ex4xvS4wHX7UDmsQmfu8w) - Communication platform for developers.
  187. - IRC channel at `#mindspore` (only for meeting minutes logging purpose)
  188. - Video Conferencing: TBD
  189. - Mailing-list: <https://mailweb.mindspore.cn/postorius/lists>
  190. ## Contributing
  191. Welcome contributions. See our [Contributor Wiki](https://gitee.com/mindspore/mindspore/blob/master/CONTRIBUTING.md) for
  192. more details.
  193. ## Maintenance phases
  194. Project stable branches will be in one of the following states:
  195. | **State** | **Time frame** | **Summary** |
  196. |-------------|---------------|--------------------------------------------------|
  197. | Planning | 1 - 3 months | Features are under planning. |
  198. | Development | 3 months | Features are under development. |
  199. | Maintained | 6 - 12 months | All bugfixes are appropriate. Releases produced. |
  200. | Unmaintained| 0 - 3 months | All bugfixes are appropriate. No Maintainers and No Releases produced. |
  201. | End Of Life (EOL) | N/A | Branch no longer accepting changes. |
  202. ## Maintenance status
  203. | **Branch** | **Status** | **Initial Release Date** | **Next Phase** | **EOL Date** |
  204. |--------|--------------|----------------------|-----------------------------------|------------|
  205. | **r1.2** | Development | 2021-03-31 estimated | Maintained <br> 2021-03-31 estimated | |
  206. | **r1.1** | Maintained | 2020-12-31 | Unmaintained <br> 2021-06-30 estimated | |
  207. | **r1.0** | Maintained | 2020-09-24 | Unmaintained <br> 2021-03-30 estimated | |
  208. | **r0.7** | Unmaintained | 2020-08-31 | End Of Life <br> 2021-02-28 estimated | |
  209. | **r0.6** | End Of Life | 2020-07-31 | | 2020-12-30 |
  210. | **r0.5** | Maintained | 2020-06-30 | Unmaintained <br> 2021-06-30 estimated | |
  211. | **r0.3** | End Of Life | 2020-05-31 | | 2020-09-30 |
  212. | **r0.2** | End Of Life | 2020-04-30 | | 2020-08-31 |
  213. | **r0.1** | End Of Life | 2020-03-28 | | 2020-06-30 |
  214. ## Release Notes
  215. The release notes, see our [RELEASE](https://gitee.com/mindspore/mindspore/blob/master/RELEASE.md).
  216. ## License
  217. [Apache License 2.0](https://gitee.com/mindspore/mindspore#/mindspore/mindspore/blob/master/LICENSE)