A clear and concise description of what the bug is.
When I converted a pre-trained kaldi-onnx model (https://github.com/XiaoMi/mace-models/blob/master/kaldi-models/nnet3/callhome.yml) to MACE format model, I got an error like: Exception: Unexpected fc input ndim. A dimension of shape_a = self._graph_shapes_dict[node.inputs[0]] for GEMM at convert_gemm@onnx_converter.py is 3 while the program assumes its dimension as 4.
Thank you.
To Reproduce
Steps to reproduce the problem:
1. cd /path/to/mace
2. python tools/converter.py convert --config_file=https://github.com/XiaoMi/mace-models/blob/master/kaldi-models/nnet3/callhome.yml
Error information / logs
Please include the full log and/or traceback here.
Transform model to one that can better run on device
onnx model IR version: 5
constains ops domain: ai.kaldi.dnn version: 7
Traceback (most recent call last):
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter.py", line 414, in <module>
main(unused_args=[sys.argv[0]] + unparsed)
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter.py", line 227, in main
output_graph_def = converter.run()
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter_tool/onnx_converter.py", line 451, in run
self.convert_ops(graph_def)
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter_tool/onnx_converter.py", line 528, in convert_ops
self._op_converters[node.op_type](node)
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter_tool/onnx_converter.py", line 1070, in convert_gemm
"Unexpected fc input ndim.")
File "//software/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/convert_util.py", line 20, in mace_check
raise Exception(msg)
Exception: Unexpected fc input ndim.
tools/converter.py:242: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
configs = yaml.load(f)
#[92m---------------------------------------------------
Common Configuration
---------------------------------------------------
| key | value |
===================================================
| library_name| callhome|
---------------------------------------------------
| target_abis| ['armeabi-v7a', 'arm64-v8a']|
---------------------------------------------------
| target_socs| []|
---------------------------------------------------
| model_graph_format| file|
---------------------------------------------------
| model_data_format| file|
---------------------------------------------------
#[0m
#[95m******************************************
Convert callhome model
******************************************
#[0m
#[32mLoading:#[0m
#[1A#[K#[32mLoading:#[0m 0 packages loaded
#[1A#[K#[32mINFO: #[0mAnalysed target //mace/python/tools:converter (0 packages loaded).
#[32mBuilding:#[0m no action
#[1A#[K#[32mINFO: #[0mFound 1 target...
#[32mBuilding:#[0m no action
#[1A#[K#[32m[0 / 1]#[0m [-----] BazelWorkspaceStatusAction stable-status.txt
#[1A#[KTarget //mace/python/tools:converter up-to-date:
#[32m[1 / 1]#[0m no action
#[1A#[K bazel-bin/mace/python/tools/converter
#[32m[1 / 1]#[0m no action
#[1A#[K#[32mINFO: #[0mElapsed time: 0.204s, Critical Path: 0.04s
#[32m[1 / 1]#[0m no action
#[1A#[K#[32mINFO: #[0m0 processes.
#[32m[1 / 1]#[0m no action
#[1A#[K#[32mINFO:#[0m Build completed successfully, 1 total action
#[0m
Traceback (most recent call last):
File "tools/converter.py", line 1346, in <module>
flags.func(flags)
File "tools/converter.py", line 853, in convert_func
convert_model(configs, flags.cl_mem_type)
File "tools/converter.py", line 782, in convert_model
",".join(model_config.get(YAMLKeyword.graph_optimize_options, [])))
File "//software/mace/tools/sh_commands.py", line 549, in gen_model_code
_fg=True)
File "//.local/lib/python3.6/site-packages/sh.py", line 1413, in __call__
raise exc
sh.ErrorReturnCode_1:
RAN: //anaconda3/envs/py36/bin/python bazel-bin/mace/python/tools/converter -u --platform=onnx --model_file=builds/downloads/1d5537265e4a166511a4ec69cbd12a84.pb --weight_file= --model_checksum=91f6f4088f35ffd6b2e1e8e852136b403a05693310e86c1201c78c1fc7397c1a --weight_checksum= --input_node=input --input_data_types=float32 --input_data_formats=NONE --output_node=output.log-softmax --output_data_types=float32 --output_data_formats=NONE --check_node= --runtime=cpu --template=mace/python/tools --model_tag=callhome --input_shape=1,20,23 --input_range= --output_shape=1,20,5164 --check_shape= --dsp_mode=0 --embed_model_data=False --winograd=0 --quantize=0 --quantize_range_file= --change_concat_ranges=0 --obfuscate=0 --output_dir=mace/codegen/models/callhome --model_graph_format=file --data_type=fp32_fp32 --graph_optimize_options= --cl_mem_type=image
STDOUT:
STDERR:
Additional context
Add any other context about the problem here, e.g., what you have modified about the code.
Before you open an issue, please make sure you have tried the following steps:
System information
Model deploy file (*.yml)
Describe the problem
A clear and concise description of what the bug is. When I converted a pre-trained kaldi-onnx model (https://github.com/XiaoMi/mace-models/blob/master/kaldi-models/nnet3/callhome.yml) to MACE format model, I got an error like: Exception: Unexpected fc input ndim. A dimension of
shape_a = self._graph_shapes_dict[node.inputs[0]]
for GEMM atconvert_gemm@onnx_converter.py
is 3 while the program assumes its dimension as 4. Thank you.To Reproduce
Steps to reproduce the problem:
Error information / logs
Please include the full log and/or traceback here.
Additional context
Add any other context about the problem here, e.g., what you have modified about the code.