Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paddle 1.8 ernie生成文本分类模型后,使用paddle inference tensorRT库报错 #646

Closed
lonelydancer opened this issue Apr 22, 2021 · 9 comments
Labels
wontfix This will not be worked on

Comments

@lonelydancer
Copy link

lonelydancer commented Apr 22, 2021

docker环境
docker pull hub.baidubce.com/paddlepaddle/paddle:1.8.0-gpu-cuda10.0-cudnn7-trt6
python2.7 / ernie v2.4.0
操作步骤:
运行 finetune_classifier_dygraph.py,得到model后,使用paddle_inference_demo中的例子做推理加速。

错误信息:

Error Message Summary:

Error: Operator skip_layernorm has not been registered
[Hint: op_info_ptr should not be null.] at (/paddle /trt_refine_int8/paddle/fluid/framework/op_info.h:140)

相关代码&模型:
链接: https://pan.baidu.com/s/1xVIyc2ntboVq_f7hse4uyg 提取码: gudn 复制这段内容后打开百度网盘手机App,操作更方便哦

@lonelydancer lonelydancer changed the title ernie1.8生成文本分类模型后,使用paddle inference tensorRT库报错 paddle 1.8 ernie生成文本分类模型后,使用paddle inference tensorRT库报错 Apr 22, 2021
@lonelydancer
Copy link
Author

用2.0.5版本跑,python3.6
https://github.com/lonelydancer/algorithm/blob/master/ernie_test.py
报错
I0422 09:49:28.191212 11579 tensorrt_subgraph_pass.cc:347] Prepare TRT engine (Optimize model structure, Select OP kernel etc). This process may cost a lot of time.
Traceback (most recent call last):
File "test_classifier.py", line 77, in
pred = create_predictor(args)
File "test_classifier.py", line 36, in create_predictor
predictor = create_paddle_predictor(config)
ValueError: (InvalidArgument) The Bias's size(768) should be equal to the first dim(-1) of the Input.
[Hint: Expected Y_t->dims()[0] == dims_x.d[1], but received Y_t->dims()[0]:768 != dims_x.d[1]:-1.] (at /paddle/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc:115)

@OleNet
Copy link

OleNet commented Apr 23, 2021

非 TRT 的情况下, 能够正常运行吗?

@lonelydancer
Copy link
Author

@OleNet 可以

@shangzhizhou
Copy link
Member

用2.0.5版本跑,python3.6
https://github.com/lonelydancer/algorithm/blob/master/ernie_test.py
报错
I0422 09:49:28.191212 11579 tensorrt_subgraph_pass.cc:347] Prepare TRT engine (Optimize model structure, Select OP kernel etc). This process may cost a lot of time.
Traceback (most recent call last):
File "test_classifier.py", line 77, in
pred = create_predictor(args)
File "test_classifier.py", line 36, in create_predictor
predictor = create_paddle_predictor(config)
ValueError: (InvalidArgument) The Bias's size(768) should be equal to the first dim(-1) of the Input.
[Hint: Expected Y_t->dims()[0] == dims_x.d[1], but received Y_t->dims()[0]:768 != dims_x.d[1]:-1.] (at /paddle/paddle/fluid/inference/tensorrt/convert/elementwise_op.cc:115)

请问2.0.5是什么版本?paddle好像没有发布这个版本,

@lonelydancer
Copy link
Author

lonelydancer commented May 30, 2021

@shangzhizhou我typo了,应该是 paddlepaddle_gpu-2.0.2

@shangzhizhou
Copy link
Member

好的,我们尽快复现一下问题

@fengxiaoshuai
Copy link

您好,这边根据提供的模型和脚本进行了测试,目前发现脚本存在一些问题,主要是设置trt子图的动态输入理解有误,下面是修改后可以运行的代码,参考代码链接

@lonelydancer
Copy link
Author

您好,这边根据提供的模型和脚本进行了测试,目前发现脚本存在一些问题,主要是设置trt子图的动态输入理解有误,下面是修改后可以运行的代码,参考代码链接

十分感谢。
我看了修改的几处diff,
输入的数据是
in1 = np.ones((1, 128)).astype(np.int64)
而min_input_shape = [1, 1, 768]
为什么输入的shape发生了变化呢?哪里有更详尽的文档。

@stale
Copy link

stale bot commented Aug 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reopen it. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 3, 2021
@stale stale bot closed this as completed Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants