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

Convert mxnet model to IR, name not found in symbol.list_arguments() #444

Open ningningG opened 6 years ago

ningningG commented 6 years ago

Platform (like ubuntu 16.04/win10): win10

Python version: 3.6.6

Source framework with version (like Tensorflow 1.4.1 with GPU): mxnet 1.3.0

Destination framework with version (like CNTK 2.3 with GPU): tensorflow 1.10.0 with GPU

Running scripts: mmtoir -f mxnet -n sag_cor-symbol.json -w sag_cor-0500.params -d sag_cor_line --inputShape 1,256,256

When converting there are folowing warnings and errors

[13:59:19] C:\Jenkins\workspace\mxnet-tag\mxnet\src\nnvm\legacy_json_util.cc:209: Loading symbol saved by previous version v1.1.0. Attempting to upgrade...
[13:59:19] C:\Jenkins\workspace\mxnet-tag\mxnet\src\nnvm\legacy_json_util.cc:217: Symbol successfully upgraded!
e:\app_tools\envs\mx\lib\site-packages\mxnet\module\base_module.py:55: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of:
        data
        label
  warnings.warn(msg)
Warning: MXNet Parser has not supported operator null with name data.
Warning: convert the null operator with name [data] into input layer.
Warning: MXNet Parser has not supported operator null with name label.
Traceback (most recent call last):
  File "e:\app_tools\envs\mx\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\app_tools\envs\mx\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\app_tools\envs\mx\Scripts\mmtoir.exe\__main__.py", line 9, in <module>
  File "e:\app_tools\envs\mx\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 192, in _main
    ret = _convert(args)
  File "e:\app_tools\envs\mx\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 115, in _convert
    parser.run(args.dstPath)
  File "e:\app_tools\envs\mx\lib\site-packages\mmdnn\conversion\common\DataStructure\parser.py", line 22, in run
    self.gen_IR()
  File "e:\app_tools\envs\mx\lib\site-packages\mmdnn\conversion\mxnet\mxnet_parser.py", line 268, in gen_IR
    self.rename_UNKNOWN(current_node)
  File "e:\app_tools\envs\mx\lib\site-packages\mmdnn\conversion\mxnet\mxnet_parser.py", line 391, in rename_UNKNOWN
    raise NotImplementedError()
NotImplementedError

When add 'print('current_node.name : ', current_node.name)' in gen_IR in mxnetparser.py before 'if hasattr(self, "rename" + node_type):', only 'current_node.name : data' and 'current_node.name : label' is printed, can't parse other layers, why? Please help me

namizzz commented 6 years ago

Hi @ningningG , could you provide your model file for us to debug?

ningningG commented 6 years ago

Thanks for your reply @namizzz , this is a UNet model I trained, not a pred_trained model download from the Internet. model path : https://drive.google.com/open?id=1f792k3-jmxzrxlQlCF9AXeOvv6065Tqa

kice commented 5 years ago

@namizzz Do you have any update since then?

I have a model without lost layer, which is purely for inference, also have the same kind of issue.

> mmtoir -f mxnet -n scale2.0x_model-symbol.json -w scale2.0x_model-0000.params -d scale2x -inode data -node conv7_layer
c:\program files\python37\lib\site-packages\mxnet\module\base_module.py:55: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of:
        data
  warnings.warn(msg)
Traceback (most recent call last):
  File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python37\Scripts\mmtoir.exe\__main__.py", line 9, in <module>
  File "c:\program files\python37\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 192, in _main
    ret = _convert(args)
  File "c:\program files\python37\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 80, in _convert
    parser = MXNetParser(model)
  File "c:\program files\python37\lib\site-packages\mmdnn\conversion\mxnet\mxnet_parser.py", line 242, in __init__
    assert isinstance(input_arg[3], list)
AssertionError

I dont it is nessnary to include the lost layer in the model for conversion.

Model link: https://github.com/WolframRhodium/Super-Resolution-Zoo/tree/master/waifu2x/waifu2x-caffe%40lltcggie

WSCZou commented 5 years ago

@kice I have the same problem with you. Have you solved it? d:\anaconda3\lib\site-packages\mxnet\module\base_module.py:54: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of: data prob_label warnings.warn(msg) Traceback (most recent call last): File "d:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "d:\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\Scripts\mmconvert.exe\__main__.py", line 9, in <module> File "d:\anaconda3\lib\site-packages\mmdnn\conversion\_script\convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "d:\anaconda3\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 80, in _convert parser = MXNetParser(model) File "d:\anaconda3\lib\site-packages\mmdnn\conversion\mxnet\mxnet_parser.py", line 242, in __init__ assert isinstance(input_arg[3], list) AssertionError

not-william commented 5 years ago

@kice @WSCZou I have the same error as you both, did you have any progress?

$ mmconvert -sf mxnet -iw Code/model-y1-test2/model-0000.params -in Code/model-y1-test2/model-symbol.json -df tensorflow -om Code/
[12:02:52] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.0.0. Attempting to upgrade...
[12:02:52] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
/anaconda3/lib/python3.6/site-packages/mxnet/module/base_module.py:55: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of:
        data
  warnings.warn(msg)
Traceback (most recent call last):
  File "/anaconda3/bin/mmconvert", line 10, in <module>
    sys.exit(_main())
  File "/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/_script/convert.py", line 102, in _main
    ret = convertToIR._convert(ir_args)
  File "/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/_script/convertToIR.py", line 80, in _convert
    parser = MXNetParser(model)
  File "/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/mxnet/mxnet_parser.py", line 242, in __init__
    assert isinstance(input_arg[3], list)
AssertionError
hereandnowhan commented 5 years ago

@kice @WSCZou @not-william Save the baby!!!I have the same error, did you have any progress?

mmconvert -sf mxnet -in model-symbol.json -iw model-0001.params -df pytorch -om insightface.pth d:\programdata\anaconda3\lib\site-packages\mxnet\module\base_module.py:55: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of: data warnings.warn(msg) Traceback (most recent call last): File "d:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "d:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "d:\ProgramData\Anaconda3\Scripts\mmconvert.exe__main.py", line 9, in File "d:\programdata\anaconda3\lib\site-packages\mmdnn\conversion_script\convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "d:\programdata\anaconda3\lib\site-packages\mmdnn\conversion_script\convertToIR.py", line 80, in _convert parser = MXNetParser(model) File "d:\programdata\anaconda3\lib\site-packages\mmdnn\conversion\mxnet\mxnet_parser.py", line 242, in init__ assert isinstance(input_arg[3], list) AssertionError

dylan-brasseur commented 4 years ago

@kice @WSCZou @not-william @hereandnowhan Not having the label name isn't an issue for the conversion. But for the assertion error, it's because you forgot to add the --inputShape argument for example, if your input shape is (batch, channels, h, w), you need to add : --inputShape channels,h,w to your command line