
Sense MindSpore is a new generation of full-scene HuaweiDeep Learning Framework, aiming to realize the three main goals of easy development, efficient execution and full scene coverage.
technical architecture
The overall architecture of MindSpore is divided into four layers, including model layer, expression layer, compilation and optimization layer, and runtime layer.
- model layer: Provides developers with out-of-the-box functionality, including pre-built models and development kits, as well as expanded libraries for hot research areas such as Graph Neural Networks (GNN), Deep Probabilistic Programming, and more. These resources dramatically lower the barrier for developers, enabling them to quickly get started and develop high-quality AI models.
- expression layer (math.)(MindExpression): provides developers with an interface for AI model development, training, and reasoning. It supports developers to use native Python syntax for neural network development and debugging, while the unique ability to unify dynamic and static graphs enables developers to balance development efficiency and execution performance. In the production and deployment phases, the layer also provides a scene-wide unified C++ interface, further enhancing the flexibility and compatibility of the framework. In the future, it is also planned to provide C/C++, Huawei's own programming language front-end - Cangjie and other third-party front-end docking.
- Compile Optimization Layer(MindCompiler): is the core part of the MindSpore AI framework. It uses the scene-wide unified intermediate expression (MindIR) as the medium to compile the front-end expression into the underlying language with higher execution efficiency. During the compilation process, the layer performs global performance optimizations, including hardware-independent optimizations such as automatic differentiation and algebraic simplification, as well as hardware-related optimizations such as graph-arithmetic fusion and operator generation. These optimizations significantly improve the training and inference efficiency of AI models.
- run-time layerIt supports "end-edge-cloud" AI collaboration, including federated learning, through the unified runtime architecture of "end-edge-cloud" by docking and invoking the underlying hardware algorithms in accordance with the results of compilation and optimization at the upper layer. This unified architecture enables AI applications to be seamlessly switched and deployed in different scenarios, improving application flexibility and reliability.
Key Features
- Full Scene CoverageIt supports flexible deployment in terminal, edge, and cloud scenarios, and optimally matches the power of the Ascend processor.
- efficient execution: It includes computational efficiency, data preprocessing efficiency and distributed training efficiency. Among them, the auto-parallelization technique is able to automatically select the most suitable parallelism strategy according to the model scale and the demand of computational resources, which significantly improves the efficiency of distributed training. The graph-computer fusion technique, on the other hand, can fully utilize the hardware acceleration capability to improve the computational efficiency and reduce the memory occupation and communication overhead.
- easy-to-develop: API friendly and low debugging difficulty. Provide object-oriented programming and functional programming paradigm, as well as dynamic and static unified programming experience.
- Security and Privacy: Provides Armour security enhancement libraries with technologies such as adversarial robustness, model security testing, differential privacy training, privacy breach risk assessment, data drift detection, etc. when targeting enterprise-level applications.
application scenario
Sense MindSpore is widely used in key industries such as finance, industry, Internet, telecom, energy, transportation, etc., launching rich AI applications to accelerate the digital intelligence upgrade of thousands of industries. For example, in the field of reinforcement learning, Sense MindSpore supports the implementation of classical algorithms such as QMIX, providing a powerful tool for related research.
eco-development
From 2020Open SourceSince then, Sense MindSpore technology has continued to innovate and the ecosystem has prospered. Currently, it has incubated and supported more than 50 mainstream models at home and abroad; the open-source version has been downloaded 11 million times, covering more than 2,400 cities in more than 130 countries and regions; more than 37,000 developers have participated in the community contribution; Sense has cooperated with more than 360 universities and research institutes in teaching and scientific research, and joined hands with more than 1,700 eco-partners to create more than 2,000 solutions.
Operating Instructions
1. Environmental preparation
-
Installing MindSpore::
- MindSpore can be installed via the pip command, for example
pip install mindspore
. - Depending on the hardware platform (e.g. CPU, GPU, Ascend, etc.), the corresponding version of MindSpore needs to be installed.
- MindSpore can be installed via the pip command, for example
-
Importing the necessary libraries::
- Import MindSpore and its associated modules in a Python script such as
import mindspore as ms
(math.) genusimport mindspore.nn as nn
etc.
- Import MindSpore and its associated modules in a Python script such as
2. Data loading and pre-processing
-
Load Data Set::
- Common datasets can be loaded using the dataset loading functions provided by MindSpore, such as MnistDataset.
- It is also possible to customize the way the dataset is loaded and build the dataset by reading local files or other data sources.
-
Data preprocessing::
- Pre-processing of loaded data such as image scaling, normalization, type conversion, etc.
- Data preprocessing operations can be performed using the transform module provided by MindSpore.
3、Constructing neural network model
-
Define the neural network structure::
- Use MindSpore's nn module to build neural network models, such as defining convolutional layers, fully connected layers, activation functions, etc.
- Multiple network layers can be combined into a single SequentialCell object, or a Cell class can be customized to implement more complex network structures.
-
Initialize model parameters::
- When defining the model, it is necessary to initialize the parameters of the model, such as weights and biases.
- MindSpore automatically allocates memory and initializes parameters for the model.
4. Define the loss function and optimizer
-
Selection of the loss function::
- Choose the appropriate loss function according to the type of task, for example, the classification task can use the cross-entropy loss function.
- MindSpore provides a variety of commonly used loss functions that can be called directly.
-
Selection Optimizer::
- Select the appropriate optimizer based on the task requirements and model complexity, e.g., SGD, Adam, etc.
- The optimizer can be configured by specifying hyperparameters such as the learning rate.
5. Training process
-
Define the training function::
- Write a training function that accepts data and labels as input and returns loss values and predictions.
- In the training function, operations such as performing forward propagation, calculating loss values, performing backpropagation, and updating model parameters need to be performed.
-
Execute the training cycle::
- A loop is used to iterate through the training dataset and the training function is called in each iteration to update the model parameters.
- Some callback functions can be set to monitor the training process, such as printing loss values, saving the model, etc.
6. Model evaluation and testing
-
Load test dataset::
- Load the test dataset using the same method as the training dataset.
-
Evaluating model performance::
- The model is run on a test dataset and evaluation metrics (e.g., accuracy, recall, etc.) are computed to evaluate the model performance.
7. Model deployment and reasoning
-
Export model::
- Once training is complete, the model can be exported to MindSpore's model format for deployment and inference.
-
Loading the model for inference::
- In scenarios where inference is required, the exported model is loaded and inference operations are performed using the input data.
8. Advanced Functions
-
distributed training::
- MindSpore supports distributed training, you can configure the parameters to start multiple training nodes for parallel training.
-
Model Compression and Optimization::
- Model compression and optimization functions such as pruning and quantization are provided to reduce model size and computation.
-
Automatic Differentiation and Graph Optimization::
- MindSpore supports automatic differentiation and graph optimization features that automatically calculate gradients and perform graph-level optimization.
data statistics
Relevant Navigation

Open source AI model with 24 billion parameters featuring low-latency optimization and imperative task fine-tuning for conversational AI, low-latency automation, and domain-specific expertise applications.

BLOOM
A large open-source multilingual language model developed by over 1,000 researchers from more than 60 countries and 250 institutions, with 176B parameters and trained on the ROOTS corpus, supporting 46 natural languages and 13 programming languages, aims to advance the research and use of large-scale language models by academics and small companies.

Ovis2
Alibaba's open source multimodal large language model with powerful visual understanding, OCR, video processing and reasoning capabilities, supporting multiple scale versions.

FLUX.1-Kontext
A multimodal model that supports text generation and image editing with powerful contextual understanding and authoring capabilities.

s1
An AI model developed by Fei-Fei Li's team that achieves superior inference performance at a very low training cost.

BERT
Developed by Google, the pre-trained language model based on the Transformer architecture provides a powerful foundation for a wide range of NLP tasks by learning bi-directional contextual information on large-scale textual data with up to tens of billions of parameters, and has achieved significant performance gains across multiple tasks.

AingDesk
Open source one-click deployment tool for AI models, which provides users with a convenient platform to run and share a variety of big AI models.

Gemma
Google's lightweight, state-of-the-art open-source models, including Gemma 2B and Gemma 7B scales, each available in pre-trained and instruction-fine-tuned versions, are designed to support developer innovation, foster collaboration, and lead to responsible use of the models through their powerful language understanding and generation capabilities.
No comments...