XiaoMi / mace-models

Mobile AI Compute Engine Model Zoo
Apache License 2.0
371 stars 73 forks source link

sre_16, Exception: Unexpected fc input ndim. #13

Closed qq932546734 closed 4 years ago

qq932546734 commented 5 years ago

Hi, guys~ I got an Error when I tried to convert the sre16 onnx model to MACE format model. Exception: Unexpected fc input ndim.

The command I used is: python tools/converter.py convert --config=../mace-models/kaldi-models/nnet3/sre_16.yml The configuration file _sre16.yml is exactly the same with the one provided by this repo.

Thank you for your time!!!

The full traceback:

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 "/datasdc_3421/cgh/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 "/datasdc_3421/cgh/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter.py", line 227, in main
    output_graph_def = converter.run()
  File "/datasdc_3421/cgh/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 "/datasdc_3421/cgh/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter_tool/onnx_converter.py", line 527, in convert_ops
    self._op_converters[node.op_type](node)
  File "/datasdc_3421/cgh/mace/bazel-bin/mace/python/tools/converter.runfiles/mace/mace/python/tools/converter_tool/onnx_converter.py", line 1065, in convert_gemm
    "Unexpected fc input ndim.")
  File "/datasdc_3421/cgh/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.
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 "/datasdc_3421/cgh/mace/tools/sh_commands.py", line 549, in gen_model_code
    _fg=True)
  File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/sh.py", line 1413, in __call__
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /root/.pyenv/versions/3.6.3/bin/python bazel-bin/mace/python/tools/converter -u --platform=onnx --model_file=/datasdc_3421/cgh/kaldi-onnx/sre16_optimized.onnx --weight_file= --model_checksum=d5f04ec3c7b0fcfdebb491154b3edc2d28a3c7f3c7895816efec96d5a08743ad --weight_checksum= --input_node=input --input_data_types=float32 --input_data_formats=NHWC --output_node=tdnn6.affine --output_data_types=float32 --output_data_formats=NHWC --check_node= --runtime=cpu --template=mace/python/tools --model_tag=sre16 --input_shape=1, 100, 23 --input_range= --output_shape=1, 100, 512 --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/sre16 --model_graph_format=file --data_type=fp32_fp32 --graph_optimize_options= --cl_mem_type=image
TonyMou commented 5 years ago

Update your MACE to the latest version.