模型轉換在KL520上面的問題

我们目前正在尝试移植一个在APA中用到的关键点模型。这个模型我们目前正在根据Kneron支持的operation进行修改。现在这个版本的模型在 evaluate() 的时候有如下的报警信息:

这个模型有用到Resize的操作,但是没有用到Slice。我不是很确定这里为什么会有针对Slice的报警。另外,这个报警信息是否说明 “Resize”这个操作是可以在CPU上完成的?

模型的quantization看起来是正常的:


模型的compile也通过了:


下一步的 hardware simulation时出了问题:

---------- start npu ----------

---------- start cpu ----------

---- cpu node: cpu_op_type = 

unsupported cpu node in setup bincpu function not identified

terminate called after throwing an instance of 'std::out_of_range'

 what(): _Map_base::at

---------------------------------------------------------------------------

CalledProcessError            Traceback (most recent call last)

/workspace/E2E_Simulator/python_flow/nef/nef.py in nef_inference(model_name, platform, data_type, nef_folder, input_files, input_folder, output_folder, reordering, ioinfo_file, dump)

  201        subprocess.run([constants.CSIM520, "-d", dump, command, weight, *input_files, setup,

--> 202                "--thread", "1"], check=True)

  203        output = utils.csim_520_to_np(


/workspace/miniconda/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)

  511      raise CalledProcessError(retcode, process.args,

--> 512                   output=stdout, stderr=stderr)

  513  return CompletedProcess(process.args, retcode, stdout, stderr)


CalledProcessError: Command '['/workspace/E2E_Simulator/python_flow/bin/current/npu_sim', '-d', '0', '/data1/batch_compile/model_32771_command.bin', '/data1/batch_compile/model_32771_weight.bin', '/data1/batch_compile/out/nef/inputs/model_32771/520_csim_rgba_in_0.bin', '/data1/batch_compile/model_32771_setup.bin', '--thread', '1']' died with <Signals.SIGABRT: 6>.


During handling of the above exception, another exception occurred:


LibError                 Traceback (most recent call last)

/tmp/ipykernel_1997/2142963877.py in <module>

----> 1 hw_results = ktc.kneron_inference([input_data], nef_file = compile_result, platform = 520)

   2 print("\n=============== hw results {} ===================\n".format(len(hw_results)))

   3 for idx, res in enumerate(hw_results):

   4  print("result {} has shape: {}".format(idx, res.sh

Comments

  • @David Yang

    Hi David,

    可能需要請您提供一下 models (.onnx、.bie、.nef)。

  • edited August 2022

    @David Yang

    Hi David,

    這個 model (APANetV1_0920.onnx onnx model) 裡面含有較多 KL520 NPU 不支援的 node,主要有兩點問題。

    第一點是 Slice

    造成第一點 CPU ops types : Slice 的原因是,因為 operators Conv name : 

    "Conv_4" group->3

    "Conv_12" group->7

    "Conv_20" group->19

    "Conv_28" group->19

    "Conv_35" group->19

    "Conv_42" group->19

    "Conv_49" group->46

    "Conv_57" group->46

    "Conv_64" group->46

    "Conv_71" group->46

    "Conv_78" group->46

    "Conv_85" group->46

    "Conv_92" group->46

    其中這些 operator 的 group 會造成 hardware simulation 錯誤,可以的話您可以試試將 group 改為 group = 1 或是 group = batchsize (如下圖)或手動用其他方式實現這個 operators。


    第二點為 Resize

    造成 CPU ops types: KneronResize 的原因是,因為 operators Resize name :

    "Resize_100"、

    "Resize_104"、

    "Resize_108"

    目前這些 Resize mode 為 linear (如下圖), Kneron ToolChain 尚未 support,這些 operator 均會造成 hardware simulation 錯誤,可以試試把這些 mode 改成 nearest,或手動用其他方式實現這些 operators。


The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.