From 32f07216e0ddf551a0e0be5ca5dcbd5fe26a8706 Mon Sep 17 00:00:00 2001 From: Pei Yang Date: Fri, 15 May 2020 18:07:53 +0800 Subject: [PATCH] fix bert bug using trt6 when compile with CUDA_ARCH_NAME=All (#24576) test=develop Co-authored-by: nhzlx --- .../inference/tensorrt/convert/emb_eltwise_layernorm.cc | 6 +++--- paddle/fluid/inference/tensorrt/op_teller.cc | 1 - .../inference/tests/api/trt_dynamic_shape_ernie_test.cc | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc index 8c0f1896ed0..0f2e71cd5b5 100644 --- a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc +++ b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc @@ -91,9 +91,9 @@ class EmbEltwiseLayerNormOpConverter : public OpConverter { input_embs, bias, scale, emb_sizes, bias_size, scale_size, hidden, eps); #else - PADDLE_THROW( - platform::errors::Fatal("use EmbEltwiseLayernormPluginDynamic " - "FP16, but GPU doesn't have FP16.")); + plugin = new plugin::EmbEltwiseLayernormPluginDynamic( + input_embs, bias, scale, emb_sizes, bias_size, scale_size, hidden, + eps); #endif } else { plugin = new plugin::EmbEltwiseLayernormPluginDynamic( diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 3ad46d36de6..db077ff306f 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -29,7 +29,6 @@ struct SimpleOpTypeSetTeller : public Teller { teller_set.insert("fused_embedding_eltwise_layernorm"); teller_set.insert("multihead_matmul"); teller_set.insert("skip_layernorm"); - teller_set.insert("slice"); #endif } diff --git a/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc b/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc index 52b3d2abd30..5fbf0867ba2 100644 --- a/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc +++ b/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc @@ -120,7 +120,7 @@ void trt_ernie(bool with_fp16, std::vector result) { if (with_fp16) { precision = AnalysisConfig::Precision::kHalf; } - config.EnableTensorRtEngine(1 << 30, 1, 1, precision, false, true); + config.EnableTensorRtEngine(1 << 30, 1, 5, precision, false, true); config.SetTRTDynamicShapeInfo(min_input_shape, max_input_shape, opt_input_shape); std::vector out_data; -- GitLab