Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
lvhaoyu d3b09fcfd5 | 1 year ago | |
---|---|---|
ms_adapter | 1 year ago | |
testing/ut | 1 year ago | |
third_party | 1 year ago | |
.drone.yml | 1 year ago | |
.gitignore | 1 year ago | |
CONTRIBUTING_CN.md | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
SupportedList.md | 1 year ago | |
pylint_check.sh | 1 year ago | |
pylintrc | 1 year ago | |
requirements.txt | 1 year ago | |
run.sh | 1 year ago | |
setup.py | 1 year ago |
简体中文 | English
MindSpore适配PyTorch接口工具。
MSAdapter可以使PyTorch的模型在昇腾(Ascend)上运行。
import torch
替换为import ms_adapter.pytorch
即可实现模型能支持昇腾上训练。pip install ms_adapter
git clone https://git.openi.org.cn/OpenI/MSAdapter.git
cd MSAdapter
python setup.py install
在构建模型上,MSAdapter可以和PyTorch一样使用,示例如下:
from ms_adapter.pytorch.nn import Module, Linear, Flatten
class MLP(Module):
def __init__(self):
super(MLP, self).__init__()
self.flatten = Flatten()
self.line1 = Linear(in_features=1024, out_features=64)
self.line2 = Linear(in_features=64, out_features=128, bias=False)
self.line3 = Linear(in_features=128, out_features=10)
def forward(self, inputs):
x = self.flatten(inputs)
x = self.line1(x)
x = self.line2(x)
x = self.line3(x)
return x
net = MLP()
对于网络迁移工作,从PyTorch代码迁移到MindSpore只需修改导入包。
MindSpore对PyTorch接口的支持工具
Python Markdown
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》