MMdnn icon indicating copy to clipboard operation
MMdnn copied to clipboard

error happens when converting the linear layer

Open flyangovoyang opened this issue 5 years ago • 4 comments

Platform (like ubuntu 16.04/win10): ubuntu 16.04 Python version: 3.7 Source framework with version (like Tensorflow 1.4.1 with GPU): pytorch 1.5.1 with GPU Destination framework with version (like CNTK 2.3 with GPU): tensorflow 1.13 with GPU Pre-trained model path (webpath or webdisk path): no pre-trained model, just a simple neural network for testing the package Running scripts:

python convertToIR.py -f pytorch -in test_model.pth -d ir --inputShape 4

simple model:

class net(nn.Module):
    def __init__(self):
        super(net, self).__init__()
        self.linear = nn.Linear(4, 2)

    def forward(self, x):
        return self.linear(x)

dump_model was generated by torch.save(model, 'test_model.pth')

error happens when converting linear layer.

root@b3dccc9e79bd:/opt/conda/lib/python3.7/site-packages/mmdnn/conversion/_script# python convertToIR.py -f pytorch -in test_model.pth -d ir --inputShape 4
Traceback (most recent call last):
  File "convertToIR.py", line 204, in <module>
    _main()
  File "convertToIR.py", line 199, in _main
    ret = _convert(args)
  File "convertToIR.py", line 122, in _convert
    parser.run(args.dstPath)
  File "/opt/conda/lib/python3.7/site-packages/mmdnn/conversion/common/DataStructure/parser.py", line 22, in run
    self.gen_IR()
  File "/opt/conda/lib/python3.7/site-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 106, in gen_IR
    func(current_node)
  File "/opt/conda/lib/python3.7/site-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 406, in rename_FullyConnected
    while parent.type == 'onnx::Flatten' or parent.type == 'onnx::Dropout':
AttributeError: 'NoneType' object has no attribute 'type'

flyangovoyang avatar Jul 29 '20 12:07 flyangovoyang

@flyangovoyang, thank you for your feedback, the original design of pytorch parser was to converting industiral DL models in which (N)CHW dataformat used widely. 1-D datainput is not supported and some special occasion maybe omitted

XiaoXYe avatar Jul 29 '20 13:07 XiaoXYe

@flyangovoyang, thank you for your feedback, the original design of pytorch parser was to converting industiral DL models in which (N)CHW dataformat used widely. 1-D datainput is not supported and some special occasion maybe omitted

My model's input's shape is [Batch_Size, Max_Length], since I observed that the tutorial ignore the batch axis, the ordinary NLP model's input will then become 1-D input for sure. anyway, how long do you think this problem can be solved?

flyangovoyang avatar Jul 29 '20 13:07 flyangovoyang

ummm, MMdnn lacks NLP operators support and model test, sorry I am not sure about that.

XiaoXYe avatar Jul 29 '20 13:07 XiaoXYe

got it. thanks for your time.

flyangovoyang avatar Jul 29 '20 13:07 flyangovoyang