Error converting from PyTorch to IR in Docker mmdnn/mmdnn:cpu.small
Platform (like ubuntu 16.04/win10): Ubuntu 16.04.4 LTS, Docker image: mmdnn/mmdnn:cpu.small Python version: 3.5 Source framework with version (like Tensorflow 1.4.1 with GPU): PyTorch 0.4 Destination framework with version (like CNTK 2.3 with GPU): IR Pre-trained model path (webpath or webdisk path): resnet101 Running scripts: mmtoir -f pytorch -d resnet101 --inputShape 3,224,224 -n imagenet_resnet101.pth
Running following commands:
root@291e2e238d7b:/mmdnn/example# mmdownload -f pytorch -n resnet101 -o ./ Downloading: "https://download.pytorch.org/models/resnet101-5d3b4d8f.pth" to /root/.torch/models/resnet101-5d3b4d8f.pth 100.0% PyTorch pretrained model is saved as [./imagenet_resnet101.pth].
root@291e2e238d7b:/mmdnn/example# mmtoir -f pytorch -d resnet101 --inputShape 3,224,224 -n imagenet_resnet101.pth
Traceback (most recent call last):
File "/usr/local/bin/mmtoir", line 11, in
Resulting in error through wrong arg formating.
Changing file:
root@291e2e238d7b:/mmdnn/example# nano /usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py
From line 75 till " parser = PytorchParser(args.network, inputshape)" with:
elif args.srcFramework == 'pytorch':
assert args.inputShape != None
inputshape = []
for x in args.inputShape:
shape = x.split(',')
inputshape = [int(x) for x in shape]
from mmdnn.conversion.pytorch.pytorch_parser import PytorchParser
parser = PytorchParser(args.network, inputshape)
Eliminates error:
root@291e2e238d7b:/mmdnn/example# mmtoir -f pytorch -d resnet101 --inputShape 3,224,224 -n imagenet_resnet101.pth IR network structure is saved as [resnet101.json]. IR network structure is saved as [resnet101.pb]. IR weights are saved as [resnet101.npy].
Thank you for your issues and your fix. We will fix it in our next release.