Feature Advice
Linux
Windows
Ascend
GPU
CPU
Environment Preparation
Basic
Intermediate
Q: Is the input=np.random.uniform(...)
format fixed when the MindIR format is exported?
A: The format is not fixed. This step is to create an input for constructing the network structure. You only need to input the correct shape
in export
. You can use np.ones
and np.zeros
to create an input.
Q: What framework models and formats can be directly read by MindSpore? Can the PTH Model Obtained Through Training in PyTorch Be Loaded to the MindSpore Framework for Use?
A: MindSpore uses protocol buffers (Protobuf) to store training parameters and cannot directly read framework models. A model file stores parameters and their values. You can use APIs of other frameworks to read parameters, obtain the key-value pairs of parameters, and load the key-value pairs to MindSpore. If you want to use the .ckpt file trained by a framework, read the parameters and then call the save_checkpoint
API of MindSpore to save the file as a .ckpt file that can be read by MindSpore.
Q: What should I do if a Protobuf memory limit error is reported during the process of using ckpt or exporting a model?
A: When a single Protobuf data is too large, because Protobuf itself limits the size of the data stream, a memory limit error will be reported. At this time, the restriction can be lifted by setting the environment variable PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
.
Q: What is the difference between the PyNative and Graph modes?
A: Compare through the following four aspects:
In terms of network execution:operators used in the two modes are the same. Therefore, when the same network and operators are executed in the two modes, the accuracy is the same. As Graph mode uses graph optimization, calculation graph sinking and other technologies, it has higher performance and efficiency in executing the network.
In terms of application scenarios,:Graph mode requires the network structure to be built at the beginning, and then the framework performs entire graph optimization and execution. This mode is suitable to scenarios where the network is fixed and high performance is required.
The two modes are supported on different hardware (such as
Ascend
,GPU
, andCPU
).In terms of code debugging,:since operators are executed line by line in PyNative mode, you can directly debug the Python code and view the
/api
output or execution result of the corresponding operator at any breakpoint in the code. In Graph mode, the network is built but not executed in the constructor function. Therefore, you cannot obtain the output of the corresponding operator at breakpoints in theconstruct
function. You can only specify operators and print their output results, and then view the results after the network execution is completed.
Q: Does MindSpore run only on Huawei Ascend
?
A: MindSpore supports Huawei Ascend
, GPUs
, and CPUs
, and supports heterogeneous computing.
Q: If MindSpore and PyTorch are installed in an environment, can the syntax of the two frameworks be used together in a Python file?
A: You can use the two frameworks in a python file. Pay attention to the differences between types. For example, the tensor types created by the two frameworks are different, but the basic types of Python are general.
Q: Can MindSpore read a TensorFlow checkpoint?
A: The checkpoint format of MindSpore is different from that of TensorFlow. Although both use the Protocol Buffers, their definitions are different. Currently, MindSpore cannot read the TensorFlow or Pytorch checkpoints.
Q: How do I use models trained by MindSpore on Ascend 310? Can they be converted to models used by HiLens Kit?
A: Yes. HiLens Kit uses Ascend 310 as the inference core. Therefore, the two questions are essentially the same. Ascend 310 requires a dedicated OM model. Use MindSpore to export the ONNX or AIR model and convert it into an OM model supported by Ascend 310. For details, see Multi-platform Inference.
Q: Can MindSpore be converted to an AIR model on Ascend 310?
A: An AIR model cannot be exported from the Ascend 310. You need to load a trained checkpoint on the Ascend 910, export an AIR model, and then convert the AIR model into an OM model for inference on the Ascend 310. For details about the Ascend 910 installation, see the MindSpore Installation Guide at here.
Q: Does MindSpore need a GPU computing unit? What hardware support is needed?
A: MindSpore currently supports CPU, GPU, and Ascend. Currently, you can try out MindSpore through Docker images on laptops or in environments with GPUs. Some models in MindSpore Model Zoo support GPU-based training and inference, and other models are being improved. For distributed parallel training, MindSpore supports multi-GPU training. You can obtain the latest information from Road Map and project release notes.
Q: Does MindSpore have any limitation on the input size of a single Tensor for exporting and loading models?
A: Due to hardware limitations of Protobuf, when exporting to AIR and ONNX formats, the size of model parameters cannot exceed 2G; when exporting to MINDIR format, the size of a single Tensor cannot exceed 2G. MindSpore only supports MINDIR, and the size of a single Tensor cannot exceed 2G.
Q: Does MindSpore have any plan on supporting other types of heterogeneous computing hardwares?
A: MindSpore provides pluggable device management interface so that developer could easily integrate other types of heterogeneous computing hardwares like FPGA to MindSpore. We welcome more backend support in MindSpore from the community.
Q: The recent announced programming language such as taichi got Python extensions that could be directly used as import taichi as ti
. Does MindSpore have similar support?
A: MindSpore supports Python native expression via import mindspore
.
Q: Does MindSpore support truncated gradient?
A: Yes. For details, see Definition and Usage of Truncated Gradient.
Q: What is the MindSpore IR design concept?
A: Function expression: All expressions are functions, and differentiation and automatic parallel analysis are easy to implement without side effect. JIT
compilation capability: The graph-based IR, control flow dependency, and data flow are combined to balance the universality and usability. Graphically complete IR: More conversion Python
flexible syntax, including recursion, etc.
Q: What are the advantages and features of MindSpore parallel model training?
A: In addition to data parallelism, MindSpore distributed training also supports operator-level model parallelism. The operator input tensor can be tiled and parallelized. On this basis, automatic parallelism is supported. You only need to write a single-device script to automatically tile the script to multiple nodes for parallel execution.
Q: How does MindSpore implement semantic collaboration and processing? Is the popular Formal Concept Analysis (FCA) used?
A: The MindSpore framework does not support FCA. For semantic models, you can call third-party tools to perform FCA in the data preprocessing phase. MindSpore supports Python therefore import FCA
could do the trick.
Q: Does MindSpore have any plan or consideration on the edge and device when the training and inference functions on the cloud are relatively mature?
A: MindSpore is a unified cloud-edge-device training and inference framework. Edge has been considered in its design, so MindSpore can perform inference at the edge. The open-source version will support Ascend 310-based inference. The optimizations supported in the current inference stage include quantization, operator fusion, and memory overcommitment.
Q: How does MindSpore support automatic parallelism?
A: Automatic parallelism on CPUs and GPUs are being improved. You are advised to use the automatic parallelism feature on the Ascend 910 AI processor. Follow our open source community and apply for a MindSpore developer experience environment for trial use.
Q: Does MindSpore have a module that can implement object detection algorithms as TensorFlow does?
A: The TensorFlow’s object detection pipeline API belongs to the TensorFlow’s Model module. After MindSpore’s detection models are complete, similar pipeline APIs will be provided.
Q: How do I perform transfer learning in PyNative mode?
A: PyNative mode is compatible with transfer learning. For more tutorial information, see Code for Loading a Pre-Trained Model.
Q: What is the difference between MindSpore ModelZoo and Ascend ModelZoo?
A: MindSpore ModelZoo
contains models only implemented by MindSpore. But these models support different devices including Ascend, GPU, CPU and mobile. Ascend ModelZoo
contains models only running on Ascend which are implemented by different ML platform including MindSpore, PyTorch, TensorFlow and Caffe. You can refer to the corresponding gitee repository.
As for the models implemented by MindSpore running on Ascend, these are maintained in MindSpore ModelZoo
, and will be released to Ascend ModelZoo
regularly.
Q: What is the relationship between Ascend and NPU?
A: NPU refers to a dedicated processor for neural network algorithms. Different companies have different NPU architectures. Ascend is an NPU processor based on the DaVinci architecture developed by Huawei.