MSAdapter
MSAdapter is a MindSpore ecological adaptation tool, which quickly migrates three-party framework code such as PyTorch/JAX to the MindSpore ecosystem without changing the user's original usage habits, helping users efficiently use the Ascend computing power of the China Computing NET.
简体中文 | [English]
MindTorch
Introduction
MindTorch is MindSpore tool for adapting the PyTorch interface, which is designed to make PyTorch code perform efficiently on Ascend without changing the habits of the original PyTorch users.
- PyTorch interface support: MindTorch aims to support the original expression of PyTorch syntax, users just need to replace
import torch
in PyTorch source code with import mindtorch.torch
to realize that the model can support training on ascending. The support status of the higher-order APIs used in the model can be found here Supported List.
- PyTorch interface support scope: MindTorch is currently mainly adapted to PyTorch data processing and model structure part of the code, currently fully supports MindSpore's PYNATIVE mode training, part of the network structure support GRAPH mode training.
- TorchVision interface support: MindTorch TorchVision is a computer vision tool library migrated from PyTorch's official implementation. It continues to use PyTorch's official api design, and calls
MindSpore
operators for calculations to achieve the same functions as the original torchvision
library. Users only need to replace import torchvision
in the PyTorch source code with import mindtorch.torchvision
.
TorchVision support status can be found from here TorchVision Supported List
Install
Please check the Version Description to select the required version of MindTorch and MindSpore.
Install MindSpore
Please install MindSpore according to the Installation Guide on MindSpore official website.
Install MindTorch
via pip
pip install mindtorch (MindSpore version >= 2.2.1)
or
pip install msadapter (MindSpore version == 2.0.0)
via source code
git clone https://git.openi.org.cn/OpenI/MSAdapter.git
cd MSAdapter
python setup.py install
If there is an insufficient permissions message, install as follows
python setup.py install --user || exit 1
User guide
Refer to the User Guide, you will quickly get started and complete the transformation from PyTorch code, as well as get started with various advanced optimization skills; More over, if you have requirements for precision and performance tuning, please refer to the Debugging and Tuning Guide.
Resources
- Model library: MindTorch supports rich deep learning applications, migration to MindTorch models from the official PyTorch code is given here: Model Resources.
Version Description
Intermediate Version:
- For MindSpore 2.2.1, and the package name of "msadapter" is still used in the user script (The package name has been changed from "msadapter" to "mindtorch", it is recommended to use Tools to switch to "mindtorch" with one click)
pip install git+https://openi.pcl.ac.cn/OpenI/MSAdapter.git@da13b6719c
- For MindSpore 2.1.0:
pip install git+https://openi.pcl.ac.cn/OpenI/MSAdapter.git@59f62a1858
On Going and Future Work
- Supports the Torch automatic differentiation APIs.
- Supports Torch distributed APIs.
- Network performance optimization.
Contributing
Developers are welcome to contribute. For more details, please see our Contribution Guidelines.
License
Apache License 2.0