Package: mindspore
查看中文What Is MindSporeAutomatic DifferentiationAutomatic ParallelInstallationPip mode method installationSource code compilation installationDocker ImageQuickstartDocsCommunityGovernanceCommunicationContributingMaintenance phasesMaintenance statusRelease NotesLicenseWhat Is MindSporeMindSpore 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.For more details please check out ourArchitecture Guide.Automatic DifferentiationCurrently, there are two automatic differentiation techniques in mainstream deep learning frameworks:Operator Overloading (OO): Overloading the basic operators of the programming language to encapsulate their gradient rules. 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.Source Transformation (ST): 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.PyTorch used OO. Compared to ST, OO generates gradient graph in runtime, so it does not need to take function call and control flow into consideration, which makes it easier to develop. However, OO can not perform gradient graph optimization in compilation time and the control flow has to be unfolded in runtime, so it is difficult to achieve extreme optimization in performance.MindSpore implemented automatic differentiation based on ST. 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.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 ParallelThe 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.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.InstallationPip mode method installationMindSpore offers build options across multiple backends:Hardware PlatformOperating SystemStatusAscend910Ubuntu-x86✔️Ubuntu-aarch64✔️EulerOS-aarch64✔️CentOS-x86✔️CentOS-aarch64✔️GPU CUDA 10.1Ubuntu-x86✔️CPUUbuntu-x86✔️Ubuntu-aarch64✔️Windows-x86✔️For installation usingpip, takeCPUandUbuntu-x86build version as an example:Download whl fromMindSpore download page, and install the package.pipinstallhttps://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.whlRun the following command to verify the install.importnumpyasnpimportmindspore.contextascontextimportmindspore.nnasnnfrommindsporeimportTensorfrommindspore.opsimportoperationsasPcontext.set_context(mode=context.GRAPH_MODE,device_target="CPU")classMul(nn.Cell):def__init__(self):super(Mul,self).__init__()self.mul=P.Mul()defconstruct(self,x,y):returnself.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.]Use pip mode method to install MindSpore in different environments. Refer to the following documents.Using pip mode method to install MindSpore in Ascend environmentUsing pip mode method to install MindSpore in GPU environmentUsing pip mode method to install MindSpore in CPU environmentSource code compilation installationUse the source code compilation method to install MindSpore in different environments. Refer to the following documents.Using the source code compilation method to install MindSpore in Ascend environmentUsing the source code compilation method to install MindSpore in GPU environmentUsing the source code compilation method to install MindSpore in CPU environmentDocker ImageMindSpore docker image is hosted onDocker Hub,
currently the containerized build options are supported as follows:Hardware PlatformDocker Image RepositoryTagDescriptionCPUmindspore/mindspore-cpux.y.zProduction environment with pre-installed MindSporex.y.zCPU release.develDevelopment environment provided to build MindSpore (withCPUbackend) from the source, refer tohttps://www.mindspore.cn/install/enfor installation details.runtimeRuntime environment provided to install MindSpore binary package withCPUbackend.GPUmindspore/mindspore-gpux.y.zProduction environment with pre-installed MindSporex.y.zGPU release.develDevelopment environment provided to build MindSpore (withGPU CUDA10.1backend) from the source, refer tohttps://www.mindspore.cn/install/enfor installation details.runtimeRuntime environment provided to install MindSpore binary package withGPU CUDA10.1backend.NOTICE:For GPUdeveldocker 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 GPUruntimedocker image.CPUForCPUbackend, you can directly pull and run the latest stable image using the below command:dockerpullmindspore/mindspore-cpu:1.1.0
dockerrun-itmindspore/mindspore-cpu:1.1.0/bin/bashGPUForGPUbackend, please make sure thenvidia-container-toolkithas been installed in advance, here are some install guidelines forUbuntuusers:DISTRIBUTION=$(./etc/os-release;echo$ID$VERSION_ID)curl-s-Lhttps://nvidia.github.io/nvidia-docker/gpgkey|apt-keyadd-
curl-s-Lhttps://nvidia.github.io/nvidia-docker/$DISTRIBUTION/nvidia-docker.list|tee/etc/apt/sources.list.d/nvidia-docker.list

sudoapt-getupdate&&sudoapt-getinstall-ynvidia-container-toolkitnvidia-docker2
sudosystemctlrestartdockerThen edit the file daemon.json:$vim/etc/docker/daemon.json{"runtimes":{"nvidia":{"path":"nvidia-container-runtime","runtimeArgs":[]}}}Restart docker again:sudosystemctldaemon-reload
sudosystemctlrestartdockerThen you can pull and run the latest stable image using the below command:dockerpullmindspore/mindspore-gpu:1.1.0
dockerrun-it-v/dev/shm:/dev/shm--runtime=nvidia--privileged=truemindspore/mindspore-gpu:1.1.0/bin/bashTo test if the docker image works, please execute the python code below and check the output:importnumpyasnpimportmindspore.contextascontextfrommindsporeimportTensorfrommindspore.opsimportfunctionalasFcontext.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 outdockerrepo for the details.QuickstartSee theQuick Startto implement the image classification.DocsMore details about installation guide, tutorials and APIs, please see theUser Documentation.CommunityGovernanceCheck out how MindSpore Open Governanceworks.CommunicationMindSpore Slack- Communication platform for developers.IRC channel at#mindspore(only for meeting minutes logging purpose)Video Conferencing: TBDMailing-list:https://mailweb.mindspore.cn/postorius/listsContributingWelcome contributions. See ourContributor Wikifor
more details.Maintenance phasesProject stable branches will be in one of the following states:StateTime frameSummaryPlanning1 - 3 monthsFeatures are under planning.Development3 monthsFeatures are under development.Maintained6 - 12 monthsAll bugfixes are appropriate. Releases produced.Unmaintained0 - 3 monthsAll bugfixes are appropriate. No Maintainers and No Releases produced.End Of Life (EOL)N/ABranch no longer accepting changes.Maintenance statusBranchStatusInitial Release DateNext PhaseEOL Dater2.2Maintained2023-10-18Unmaintained2024-10-18 estimatedr2.1Maintained2023-07-29Unmaintained2024-07-29 estimatedr2.0Maintained2023-06-15Unmaintained2024-06-15 estimatedr1.10Maintained2023-02-02Unmaintained2024-02-02 estimatedr1.9End Of Life2022-10-262023-10-26r1.8End Of Life2022-07-292023-07-29r1.7End Of Life2022-04-292023-04-29r1.6End Of Life2022-01-292023-01-29r1.5End Of Life2021-10-152022-10-15r1.4End Of Life2021-08-152022-08-15r1.3End Of Life2021-07-152022-07-15r1.2End Of Life2021-04-152022-04-29r1.1End Of Life2020-12-312021-09-30r1.0End Of Life2020-09-242021-07-30r0.7End Of Life2020-08-312021-02-28r0.6End Of Life2020-07-312020-12-30r0.5End Of Life2020-06-302021-06-30r0.3End Of Life2020-05-312020-09-30r0.2End Of Life2020-04-302020-08-31r0.1End Of Life2020-03-282020-06-30Release NotesThe release notes, see ourRELEASE.LicenseApache License 2.0