提交 033c72cf 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!188 modify MindConverter readme

Merge pull request !188 from ggpolar/br_wzk_dev
...@@ -4,11 +4,6 @@ MindConverter is a tool that converting PyTorch scripts to MindSpore scripts. Wi ...@@ -4,11 +4,6 @@ MindConverter is a tool that converting PyTorch scripts to MindSpore scripts. Wi
### System Requirements
* PyTorch v1.5.0
* MindSpore v0.2.0
### Installation ### Installation
This tool is part of MindInsight and accessible to users after installing MindInsight, no extra installation is needed. This tool is part of MindInsight and accessible to users after installing MindInsight, no extra installation is needed.
...@@ -24,8 +19,6 @@ mindconverter commandline usage: ...@@ -24,8 +19,6 @@ mindconverter commandline usage:
mindconverter [-h] [--version] --in_file IN_FILE [--output OUTPUT] mindconverter [-h] [--version] --in_file IN_FILE [--output OUTPUT]
[--report REPORT] [--report REPORT]
MindConverter CLI entry point (version: 0.2.0)
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--version show program's version number and exit --version show program's version number and exit
...@@ -36,13 +29,32 @@ optional arguments: ...@@ -36,13 +29,32 @@ optional arguments:
directorys directorys
``` ```
Usage example: #### Use example:
We have a collection of PyTorch model scripts
```buildoutcfg
~$ ls
models
~$ ls models
lenet.py resnet.py vgg.py
```
Then we set the PYTHONPATH environment variable and convert alexnet.py
```buildoutcfg
~$ export PYTHONPATH=~/models
~$ mindconverter --in_file models/lenet.py
```
Then we will see a conversion report and the output MindSpore script
```buildoutcfg ```buildoutcfg
export PYTHONPATH=~/my_pt_proj/models ~$ ls
mindconverter --in_file lenet.py lenet_report.txt models output
~$ ls output
lenet.py
``` ```
Since the conversion is not 100% flawless, we encourage users to checkout the reports when fixing issues of the converted scripts. Please checkout [models/lenet.py](../../tests/st/func/mindconverter/data/lenet_script.py) and [output/lenet.py](../../tests/st/func/mindconverter/data/lenet_converted.py) as the input/output example representatively.
Since the conversion is not 100% flawless, we encourage users to checkout the report when fixing issues of the converted script.
### Unsupported Situation #1 ### Unsupported Situation #1
......
...@@ -12,11 +12,9 @@ ...@@ -12,11 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
"""Test network script of LeNet.""" """Test network script of LeNet for ST test case data."""
import mindspore.nn as nn import mindspore.nn as nn
import mindspore.ops.operations as P import mindspore.ops.operations as P
# import torch.nn as nn
# import torch.nn.functional as F
class TestLeNet(nn.Cell): class TestLeNet(nn.Cell):
...@@ -30,11 +28,6 @@ class TestLeNet(nn.Cell): ...@@ -30,11 +28,6 @@ class TestLeNet(nn.Cell):
def construct(self, input_x): def construct(self, input_x):
"""Callback method.""" """Callback method."""
out = self.forward1(input_x)
return out
def forward1(self, input_x):
"""forward1 method."""
out = P.ReLU()(self.conv1(input_x)) out = P.ReLU()(self.conv1(input_x))
out = P.MaxPool(2, None, 'valid')(out) out = P.MaxPool(2, None, 'valid')(out)
out = P.ReLU()(self.conv2(out)) out = P.ReLU()(self.conv2(out))
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
"""Test network script of LeNet.""" """Test network script of LeNet for ST test case data."""
import torch.nn as nn import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
...@@ -28,11 +28,6 @@ class TestLeNet(nn.Module): ...@@ -28,11 +28,6 @@ class TestLeNet(nn.Module):
def forward(self, input_x): def forward(self, input_x):
"""Callback method.""" """Callback method."""
out = self.forward1(input_x)
return out
def forward1(self, input_x):
"""forward1 method."""
out = F.relu(self.conv1(input_x)) out = F.relu(self.conv1(input_x))
out = F.max_pool2d(out, 2) out = F.max_pool2d(out, 2)
out = F.relu(self.conv2(out)) out = F.relu(self.conv2(out))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册