Closed Lennon-cheng closed 1 year ago
@Lennon-cheng Thanks for your detailed log and info. That's really helpful to OpenVINO. But I need to confirm something to accelerate the debug progress.
Thanks
I finetune paddlenlp "ernie-gram-zh" pretrain model used paddlepaddle framework. this is load model code pretrained_model = paddlenlp.transformers.ErnieGramModel.from_pretrained( 'ernie-gram-zh') tokenizer = ppnlp.transformers.ErnieGramTokenizer.from_pretrained( 'ernie-gram-zh')
then use paddle2onnx convert paddle to onnx. model.onnx in zip is onnx file.
But CumSum not support. Then I modify some node and result is model1.onnx. This code convert.py is in zip.
Then I convert onnx to openvino used script.sh which is in zip.
Then I infer openvino used infer.py which is in zip.
Run: python infer.py 你 好. Can find the problem transpose node which name p2o.Transpose.65
zip download from baidu drive 链接: https://pan.baidu.com/s/1h5osf5ad5HIu7vx17RMPfw?pwd=dv25 提取码: dv25
@Lennon-cheng as OV has already supported input of Paddle format model that OV handles the paddle to ngraph conversion internally, so that it can save additional Paddle to ONNX to IR conversion. Could you please have a try? https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Integrate_OV_with_your_application.html#step-2-compile-the-model
@Lennon-cheng Hi,
ernie_1.0/model.pdmodel
in https://www.paddlepaddle.org.cn/lite/develop/demo_guides/intel_openvino.html instead.
Yes, running the generated onnx produces "CumSum layer with name 'p2o.CumSum.0' doesn't support 'axis' input tensor with non scalar rank". I think the root cause is the paddle2onnx may generate an unsupported corner case. I will look into such the problem. Don't be discouraged, you can load and run ernie_1.0/model.pdmodel
directly. That works well.ernie-gram-zh
model. The recommended step is pretrained_model ==> paddle finetune ==> paddle save inference model ==> *.pdmodel & *.pdiparams format ==> OpenVINO
. Thanks.
@Lennon-cheng Hi,
Thanks.
@xczhai Thank you very much for your help! First, I succeeded in running pdmodel using openvino!
I reorganized the whole process code. Step is paddle save inference model ==> .pdmodel & .pdiparams format ==> onnx ==> OpenVINO
The explanation is in the readme of the zip. Specifically pdmodel、pdiparams and command line is in zip.
链接: https://pan.baidu.com/s/1oiW5SGqUPurg_IGZfDZt0A?pwd=65qu 提取码: 65qu
@Lennon-cheng Thanks for your attachment.
Thanks.
@xczhai The problem is solved. Thank you very much for your help!!!
paddle ernie model convert to openvino。 There is transpose layer, after this transpose layer, why some positions of the output is become nan。 netron:
transpose inputs:
transpose outputs: