edavilandes opened a new issue #10349: Converting MXNet model to CoreML fails in param = node['attr'] URL: https://github.com/apache/incubator-mxnet/issues/10349 Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form. For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io ## Description Running mxnet_coreml_converter.py always failed in "param = node['attr']" ## Environment info (Required) Model Name: Mac mini Model Identifier: Macmini7,1 Processor Name: Intel Core i7 Processor Speed: 3 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 4 MB Memory: 8 GB Boot ROM Version: MM71.0230.B00 SMC Version (system): 2.24f32 Serial Number (system): C07VQ0CNG1J1 Hardware UUID: ECE65FC7-7E63-5EC9-AD5F-A333DE709F7F ``` What to do: 1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py 2. Run the script using `python diagnose.py` and paste its output here. ----------Python Info---------- ('Version :', '2.7.14') ('Compiler :', 'GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)') ('Build :', ('default', 'Mar 22 2018 14:43:05')) ('Arch :', ('64bit', '')) ------------Pip Info----------- ('Version :', '9.0.3') ('Directory :', '/usr/local/lib/python2.7/site-packages/pip') ----------MXNet Info----------- ('Version :', '1.1.0') ('Directory :', '/usr/local/lib/python2.7/site-packages/mxnet') ('Commit Hash :', '07a83a0325a3d782513a04f47d711710972cb144') ----------System Info---------- ('Platform :', 'Darwin-17.5.0-x86_64-i386-64bit') ('system :', 'Darwin') ('node :', 'Edgars-Mac-mini.local') ('release :', '17.5.0') ('version :', 'Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64') ----------Hardware Info---------- ('machine :', 'x86_64') ('processor :', 'i386') machdep.cpu.brand_string: Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 BMI2 INVPCID FPU_CSDS machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI ----------Network Test---------- Setting timeout: 10 Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0104 sec, LOAD: 0.6859 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0106 sec, LOAD: 0.7358 sec. Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0891 sec, LOAD: 0.3947 sec. Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0503 sec, LOAD: 0.1412 sec. Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0781 sec, LOAD: 0.3045 sec. Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.2534 sec, LOAD: 0.4151 sec. Package used (Python/R/Scala/Julia): Python with MXNET conversion to CoreML ## Build info (Required if built from source) No build from source MXNet commit hash: NA Build config: NA ## Error Message: [18:29:23] src/nnvm/legacy_json_util.cc:190: Loading symbol saved by previous version v0.8.0. Attempting to upgrade... [18:29:23] src/nnvm/legacy_json_util.cc:198: Symbol successfully upgraded! 3 : conv1, Convolution Traceback (most recent call last): File "/usr/local/bin/mxnet_coreml_converter.py", line 113, in <module> coreml_model = convert(model=mod, mode=mode, class_labels=class_labels, **kwargs) File "/usr/local/lib/python2.7/site-packages/converter/_mxnet_converter.py", line 212, in convert converter_func(net, node, model, builder) File "/usr/local/lib/python2.7/site-packages/converter/_layers.py", line 284, in convert_convolution param = node['attr'] KeyError: 'attr' ## Minimum reproducible example (If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.) ## Steps to reproduce (Paste the commands you ran that produced the error.) 1. Download the Squeezenet 2. run the following command in the same directory where Squeeznet is: mxnet_coreml_converter.py --model-prefix='squeezenet_v1.1' --epoch=0 --input-shape='{"data":"3,227,227"}' --mode=classifier --class-labels synset.txt --output-file="squeezenetv11.mlmodel" ## What have you tried to solve it? 1. Followed all install steps from pip to python to mxnet to mxnet-to-coreml 2. Reviewed the source code from the trace. It seems that the absence of the attr in the JSON for some nodes makes the convert fail. I was tempted to manually update the JSON with empty attr, but that would be time consuming.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services