PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

[General Issue]使用paddle inference推理时报错(python)

Open 1344265305 opened this issue 3 years ago • 8 comments

在进行推理这一步时,输入 python deploy/python/infer.py --emo --enable_auto_tune=True --use_trt=True 报错 实测不使用tensorrt 或者改为cpu都不报错。 以下为报错信息

/home/speed/Segmentation/paddleseg/paddleseg/models/losses/decoupledsegnet_relax_boundary_loss.py:19: DeprecationWarning: Please use shift from the scipy.ndimage namespace, the scipy.ndimage.interpolation namespace is deprecated. from scipy.ndimage.interpolation import shift /home/speed/Segmentation/paddleseg/paddleseg/transforms/functional.py:18: DeprecationWarning: Please use distance_transform_edt from the scipy.ndimage namespace, the scipy.ndimage.morphology namespace is deprecated. from scipy.ndimage.morphology import distance_transform_edt 2022-08-08 11:01:30 [INFO] Auto tune the dynamic shape for GPU TRT. I0808 11:01:30.041559 4054828 analysis_config.cc:1044] In CollectShapeInfo mode, we will disable optimizations and collect the shape information of all intermediate tensors in the compute graph and calculate the min_shape, max_shape and opt_shape. W0808 11:01:30.776191 4054828 analysis_predictor.cc:1118] The one-time configuration of analysis predictor failed, which may be due to native predictor called first and its configurations taken effect. I0808 11:01:30.794692 4054828 analysis_predictor.cc:985] ir_optim is turned off, no IR pass will be executed --- Running analysis [ir_graph_build_pass] --- Running analysis [ir_graph_clean_pass] --- Running analysis [ir_analysis_pass] --- Running analysis [ir_params_sync_among_devices_pass] I0808 11:01:30.828686 4054828 ir_params_sync_among_devices_pass.cc:100] Sync params from CPU to GPU --- Running analysis [adjust_cudnn_workspace_size_pass] --- Running analysis [inference_op_replace_pass] --- Running analysis [ir_graph_to_program_pass] I0808 11:01:30.910813 4054828 analysis_predictor.cc:1035] ======= optimize end ======= I0808 11:01:30.915236 4054828 naive_executor.cc:102] --- skip [feed], feed -> x I0808 11:01:30.917994 4054828 naive_executor.cc:102] --- skip [argmax_0.tmp_0], fetch -> fetch W0808 11:01:30.993405 4054828 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.7, Runtime API Version: 11.2 W0808 11:01:30.994926 4054828 gpu_resources.cc:91] device: 0, cuDNN Version: 8.1. 2022-08-08 11:01:33 [INFO] Auto tune success.

2022-08-08 11:01:33 [INFO] Use GPU 2022-08-08 11:01:33 [INFO] Use TRT 2022-08-08 11:01:33 [INFO] Use auto tuned dynamic shape I0808 11:01:33.587178 4054828 analysis_predictor.cc:881] TensorRT subgraph engine is enabled --- Running analysis [ir_graph_build_pass] --- Running analysis [ir_graph_clean_pass] --- Running analysis [ir_analysis_pass] 2022-08-08 11:01:33 [INFO] (InvalidArgument) Pass preln_embedding_eltwise_layernorm_fuse_pass has not been registered. [Hint: Expected Has(pass_type) == true, but received Has(pass_type):0 != true:1.] (at /paddle/paddle/fluid/framework/ir/pass.h:242)

2022-08-08 11:01:33 [INFO] If the above error is '(InvalidArgument) some trt inputs dynamic shape info not set, ..., Expected all_dynamic_shape_set == true, ...', please set --enable_auto_tune=True to use auto_tune.


欢迎您反馈PaddleSeg使用问题,辛苦您提供以下信息,方便我们快速定位和解决问题:

  1. PaddleSeg版本:2.6.0
  2. PaddlePaddle版本:2.3.1
  3. 操作系统信息:linux
  4. Python版本号:3.9
  5. CUDA/cuDNN版本:11.6/8.4.1
  6. tensorRT版本:8.4.2.4

1344265305 avatar Aug 08 '22 03:08 1344265305

看起来是输入了动态shape导致的报错,使用的是paddleseg的哪个模型呢,如果是自己的模型,可以检查下是否有xx.shape 的操作,改成paddle.shape(xx)

haoyuying avatar Aug 08 '22 06:08 haoyuying

使用的ppliteseg,导出静态模型时输出了input_shape;非常感谢您的回复

1344265305 avatar Aug 09 '22 01:08 1344265305

你安装的paddle版本不对,重新参考文档安装支持trt的版本。

juncaipeng avatar Aug 09 '22 02:08 juncaipeng

你安装的paddle版本不对,重新参考文档安装支持trt的版本。

2.3.1是最新的稳定版了吧

1344265305 avatar Aug 09 '22 02:08 1344265305

对 你需要安装编译支持trt的版本。

juncaipeng avatar Aug 09 '22 02:08 juncaipeng

看起来是输入了动态shape导致的报错,使用的是paddleseg的哪个模型呢,如果是自己的模型,可以检查下是否有xx.shape 的操作,改成paddle.shape(xx)

用动态和静态的shape都试了 都有这个错误。而且不启用trt错误消失

1344265305 avatar Aug 09 '22 02:08 1344265305

对 你需要安装编译支持trt的版本。

我安装的就是2.3.1 是最新的了

1344265305 avatar Aug 09 '22 02:08 1344265305

对 你需要安装编译支持trt的版本。

刚刚验证了一下 paddle安装没有问题,如果报错Pass trt_squeeze2_matmul_fuse_pass has not been registered.可能是paddle版本问题。但是我报的错是Pass preln_embedding_eltwise_layernorm_fuse_pass has not been registered.

1344265305 avatar Aug 09 '22 07:08 1344265305

Anything update on this?

Dawn-bin avatar Aug 14 '22 11:08 Dawn-bin

Reinstall other version PaddlePaddle.

juncaipeng avatar Aug 16 '22 07:08 juncaipeng

这个问题是没有正确安装联编trt的paddle whl包。具体参考安装文档:https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.6/docs/deployment/inference/python_inference_cn.md

juncaipeng avatar Sep 30 '22 08:09 juncaipeng

请问您解决这个问题了吗 我也遇到了

xiaochuan139 avatar Apr 11 '24 07:04 xiaochuan139