MS Converter can replace PyTorch interfaces in scripts with MindSpore (>=2.5) Mint interfaces, reducing repetitive tasks and improving development efficiency. :D
Disclaimer: The converted script may not necessarily run successfully.
pip install git+https://github.com/zhtmike/MSConverter.git
You can simply run the following command to show the updated script in the terminal
torch2mint your_pytorch_script.py
To update the script in place, run
torch2mint -i your_pytorch_script.py
To select different Mindspore version (e.g. v2.6.0) for API mapping, run
torch2mint --ms-version 2.6.0 your_pytorch_script.py
check torch2mint -h
for the detail usage.
-
To update the MindSpore Mint API list, download the
.rst
file from the MindSpore website (e.g., MindSpore 2.5.0 API List ), runtorch2mint your_pytorch_script.py --mint-api-path your_mint_api_path.rst
-
To add conversion rules, simply add a json file with the content
{"the content you want to replace": "the content you want to fill"}
similar to
assets/mapping.json
, then runtorch2mint your_pytorch_script.py --custom-mapping-path your_custom_mapping_path.json