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

pytorch to IR: , False #864

Open liuxymvp opened 4 years ago

liuxymvp commented 4 years ago

Run "mmtoir -f pytorch -d resnet101 --inputShape 3,224,224 -n imagenet_resnet101.pth" but get nothing without any error information except ", False" %3517 : int = aten::size(%3515, %3516), scope: ResNet %3520 : int = prim::Constant[value=-1](), scope: ResNet %3521 : int[] = prim::ListConstruct(%3517, %3520), scope: ResNet %input : Float(1, 2048) = aten::view(%3515, %3521), scope: ResNet %3523 : Float(2048!, 1000!) = aten::t(%625), scope: ResNet/Linear[fc] %3524 : int = prim::Constant[value=1](), scope: ResNet/Linear[fc] %3525 : int = prim::Constant[value=1](), scope: ResNet/Linear[fc] %3526 : Float(1, 1000) = aten::addmm(%626, %input, %3523, %3524, %3525), scope: ResNet/Linear[fc] return (%3526); } , False

XiaoXYe commented 4 years ago

Hi @liuxymvp, what's your torch version? MMdnn 0.3.0 only support torch 0.4.0 currently. You can find our requirements in requirements\linux-py3.txt

liuxymvp commented 4 years ago

Hi @liuxymvp, what's your torch version? MMdnn 0.3.0 only support torch 0.4.0 currently. You can find our requirements in requirements\linux-py3.txt

I build a docker container by the image 'mmdnn/mmdnn:cpu.small', the pytorch resnet18 model can be converted to IR, but the resnet101 and alexnet failed, error message : /usr/local/lib/python3.5/dist-packages/torch/serialization.py:367: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.5/dist-packages/torch/serialization.py:367: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "/usr/local/bin/mmtoir", line 11, in sys.exit(_main()) File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 184, in _main ret = _convert(args) File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 79, in _convert parser = PytorchParser(args.network, inputshape) File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 71, in init model = torch.load(model_file_name) File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 469, in _load result = unpickler.load() AttributeError: Can't get attribute '_rebuild_parameter' on <module 'torch._utils' from '/usr/local/lib/python3.5/dist-packages/torch/_utils.py'>