microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.8k stars 965 forks source link

Fail to convert resnet101 from PyTorch to IR #929

Open Ivanfangsc opened 3 years ago

Ivanfangsc commented 3 years ago

Platform (like ubuntu 16.04/win10): Ubuntu 20.04 and Windows 10

Python version: 3.9.7

Source framework with version (like Tensorflow 1.4.1 with GPU): PyTorch 1.9.1 CPU only

Destination framework with version (like CNTK 2.3 with GPU): IR

Pre-trained model path (webpath or webdisk path): mmdownload -f pytorch -n resnet101

Running scripts: mmtoir -f pytorch -n imagenet_resnet101.pth -d resnet --inputShape 3,224,224

Error reported:

Traceback (most recent call last):
  File "mmdnn/conversion/_script/convertToIR.py", line 202, in <module>
    _main()
  File "mmdnn/conversion/_script/convertToIR.py", line 197, in _main
    ret = _convert(args)
  File "/mmdnn/conversion/_script/convertToIR.py", line 97, in _convert
    parser = PytorchParser151(model, inputshape[0])
  File "mmdnn/conversion/pytorch/pytorch_parser.py", line 533, in __init__
    self.build_graph(input_shape)
  File "mmdnn/conversion/pytorch/pytorch_parser.py", line 92, in build_graph
    self.pytorch_graph.build(self.input_shape)
  File "mmdnn/conversion/pytorch/pytorch_graph.py", line 135, in build
    output_shape = [int(x.replace('!', '')) for x in output_shape_str[1].split(',')]
  File "mmdnn/conversion/pytorch/pytorch_graph.py", line 135, in <listcomp>
    output_shape = [int(x.replace('!', '')) for x in output_shape_str[1].split(',')]
ValueError: invalid literal for int() with base 10: ' strides'