Go to file
mindspore-ci-bot ddac441dfd !6171 [MD] loading dataset log / dataset validation / dataset description
Merge pull request !6171 from luoyang/c-api-pyfunc
2020-09-17 21:44:42 +08:00
.gitee Add issue and PR templates for gitee and github 2020-04-08 19:58:13 +08:00
.github update .github/PULL_REQUEST_TEMPLATE.md. 2020-09-15 09:30:17 +08:00
akg@4d897c23fc fused select and greater op to improve bert perfermance on GPU 2020-09-14 15:03:00 +08:00
cmake !6324 [MSLITE][Develop] modify optimize.so to sdot and fp16 so 2020-09-17 14:11:40 +08:00
config Data Dump Bug Fix 2020-09-15 14:33:18 +08:00
docker modify Dockerfile for GPU version 2020-09-16 17:30:39 +08:00
docs add README files for ms lite 2020-08-26 17:35:22 +08:00
graphengine@6dcf11d26e sync-from-trunk-to-blue-zone-0912-c75b220 2020-09-16 11:28:22 +08:00
include fix code warning 2020-09-16 17:33:13 +08:00
mindspore !6171 [MD] loading dataset log / dataset validation / dataset description 2020-09-17 21:44:42 +08:00
model_zoo !6185 fix api comments 2020-09-17 20:48:27 +08:00
scripts fix icu4c compile 2020-09-16 11:03:18 +08:00
serving fix code warning 2020-09-16 17:33:13 +08:00
tests !6171 [MD] loading dataset log / dataset validation / dataset description 2020-09-17 21:44:42 +08:00
third_party fix securec compile options, remove unused libraries from output package 2020-09-16 18:47:12 +08:00
.clang-format update clang format rule 2020-04-21 21:21:19 +08:00
.gitignore version check 2020-09-10 20:33:46 +08:00
.gitmodules remove unused submodule incubator-tvm 2020-08-10 09:39:15 +08:00
CMakeLists.txt fix compile warning 2020-09-16 19:20:47 +08:00
CONTRIBUTING.md Update setuptool info 2020-04-10 19:11:58 +08:00
LICENSE initial version 2020-03-27 22:54:54 +08:00
NOTICE initial version 2020-03-27 22:54:54 +08:00
README.md update supported platform info 2020-09-09 10:02:45 +08:00
README_CN.md update info with ubuntu-aarch64 platform 2020-09-10 22:41:21 +08:00
RELEASE.md 0.5.2 release info 2020-09-14 16:10:52 +08:00
SECURITY.md initial version 2020-03-27 22:54:54 +08:00
Third_Party_Open_Source_Software_Notice add libevent copyright 2020-08-24 10:40:47 +08:00
build.bat Fix some tiny bugs for converter in windows enviroment 2020-09-07 15:12:18 +08:00
build.sh fix compile warning 2020-09-16 19:20:47 +08:00
requirements.txt ensure packaging version 2020-09-11 14:59:02 +08:00
setup.py combine py config files 2020-09-14 17:03:47 +08:00

README.md

MindSpore Logo

查看中文

What Is MindSpore

MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios. MindSpore is designed to provide development experience with friendly design and efficient execution for the data scientists and algorithmic engineers, native support for Ascend AI processor, and software hardware co-optimization. At the meantime MindSpore as a global AI open source community, aims to further advance the development and enrichment of the AI software/hardware application ecosystem.

MindSpore Architecture

For more details please check out our Architecture Guide.

Automatic Differentiation

There are currently three automatic differentiation techniques in mainstream deep learning frameworks:

  • 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.
  • 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.
  • 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.

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.

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.

Automatic Differentiation

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.

Automatic Parallel

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.

Automatic Parallel

At present, MindSpore uses a fine-grained parallel strategy of splitting operators, that is, each operator in the figure is splitted 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.

Installation

Binaries

MindSpore offers build options across multiple backends:

Hardware Platform Operating System Status
Ascend910 Ubuntu-x86 ✔️
Ubuntu-aarch64 ✔️
EulerOS-x86 ✔️
EulerOS-aarch64 ✔️
GPU CUDA 10.1 Ubuntu-x86 ✔️
CPU Ubuntu-x86 ✔️
Ubuntu-aarch64 ✔️
Windows-x86 ✔️

For installation using pip, take CPU and Ubuntu-x86 build version as an example:

  1. Download whl from MindSpore download page, and install the package.

    pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/0.7.0-beta/MindSpore/cpu/ubuntu_x86/mindspore-0.7.0-cp37-cp37m-linux_x86_64.whl
    
  2. Run the following command to verify the install.

    import numpy as np
    import mindspore.context as context
    import mindspore.nn as nn
    from mindspore import Tensor
    from mindspore.ops import operations as P
    
    context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
    
    class Mul(nn.Cell):
        def __init__(self):
            super(Mul, self).__init__()
            self.mul = P.Mul()
    
        def construct(self, x, y):
            return self.mul(x, y)
    
    x = Tensor(np.array([1.0, 2.0, 3.0]).astype(np.float32))
    y = Tensor(np.array([4.0, 5.0, 6.0]).astype(np.float32))
    
    mul = Mul()
    print(mul(x, y))
    
    [ 4. 10. 18.]
    

From Source

Install MindSpore.

Docker Image

MindSpore docker image is hosted on Docker Hub, currently the containerized build options are supported as follows:

Hardware Platform Docker Image Repository Tag Description
CPU mindspore/mindspore-cpu x.y.z Production environment with pre-installed MindSpore x.y.z CPU release.
devel Development environment provided to build MindSpore (with CPU backend) from the source, refer to https://www.mindspore.cn/install/en for installation details.
runtime Runtime environment provided to install MindSpore binary package with CPU backend.
GPU mindspore/mindspore-gpu x.y.z Production environment with pre-installed MindSpore x.y.z GPU release.
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.
runtime Runtime environment provided to install MindSpore binary package with GPU CUDA10.1 backend.
Ascend Coming soon.

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.

  • CPU

    For CPU backend, you can directly pull and run the latest stable image using the below command:

    docker pull mindspore/mindspore-cpu:0.7.0-beta
    docker run -it mindspore/mindspore-cpu:0.7.0-beta /bin/bash
    
  • GPU

    For GPU backend, please make sure the nvidia-container-toolkit has been installed in advance, here are some install guidelines for Ubuntu users:

    DISTRIBUTION=$(. /etc/os-release; echo $ID$VERSION_ID)
    curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
    curl -s -L https://nvidia.github.io/nvidia-docker/$DISTRIBUTION/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list
    
    sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-docker2
    sudo systemctl restart docker
    

    Then edit the file daemon.json:

    $ vim /etc/docker/daemon.json
    {
        "runtimes": {
            "nvidia": {
                "path": "nvidia-container-runtime",
                "runtimeArgs": []
            }
        }
    }
    

    Restart docker again:

    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    Then you can pull and run the latest stable image using the below command:

    docker pull mindspore/mindspore-gpu:0.7.0-beta
    docker run -it --runtime=nvidia --privileged=true mindspore/mindspore-gpu:0.7.0-beta /bin/bash
    

    To test if the docker image works, please execute the python code below and check the output:

    import numpy as np
    import mindspore.context as context
    from mindspore import Tensor
    from mindspore.ops import functional as F
    
    context.set_context(mode=context.PYNATIVE_MODE, device_target="GPU")
    
    x = Tensor(np.ones([1,3,3,4]).astype(np.float32))
    y = Tensor(np.ones([1,3,3,4]).astype(np.float32))
    print(F.tensor_add(x, y))
    
    [[[ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.]],
    
    [[ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.]],
    
    [[ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.],
    [ 2.  2.  2.  2.]]]
    

If you want to learn more about the building process of MindSpore docker images, please check out docker repo for the details.

Quickstart

See the Quick Start to implement the image classification.

Docs

More details about installation guide, tutorials and APIs, please see the User Documentation.

Community

Governance

Check out how MindSpore Open Governance works.

Communication

Contributing

Welcome contributions. See our Contributor Wiki for more details.

Release Notes

The release notes, see our RELEASE.

License

Apache License 2.0