Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
cb7f736f
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cb7f736f
编写于
12月 13, 2022
作者:
W
Wangzheee
提交者:
GitHub
12月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Paddle Inference]fix some transformer unitest (#48929)
* fix some transformer unitest
上级
0db36aca
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
16 addition
and
11 deletion
+16
-11
paddle/fluid/inference/tensorrt/convert/matmul_op.cc
paddle/fluid/inference/tensorrt/convert/matmul_op.cc
+2
-1
paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc
...e/fluid/inference/tensorrt/convert/multihead_matmul_op.cc
+6
-6
paddle/fluid/inference/tensorrt/plugin/CMakeLists.txt
paddle/fluid/inference/tensorrt/plugin/CMakeLists.txt
+3
-3
paddle/fluid/inference/tensorrt/plugin/many_emb_layernorm_kernel.cu
...id/inference/tensorrt/plugin/many_emb_layernorm_kernel.cu
+0
-0
paddle/fluid/inference/tensorrt/plugin/many_emb_layernorm_varseqlen_kernel_hface.cu
...sorrt/plugin/many_emb_layernorm_varseqlen_kernel_hface.cu
+0
-0
paddle/fluid/inference/tensorrt/plugin/many_emb_layernorm_varseqlen_kernel_mtron.cu
...sorrt/plugin/many_emb_layernorm_varseqlen_kernel_mtron.cu
+0
-0
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_serialize_deserialize_test.h
.../api/trt_dynamic_shape_ernie_serialize_deserialize_test.h
+2
-0
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
...fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
+3
-1
未找到文件。
paddle/fluid/inference/tensorrt/convert/matmul_op.cc
浏览文件 @
cb7f736f
...
...
@@ -67,7 +67,8 @@ class MatMulOpConverter : public OpConverter {
if
(
op_desc
.
HasAttr
(
"support_int8"
)
&&
PADDLE_GET_CONST
(
bool
,
op_desc
.
GetAttr
(
"support_int8"
))
&&
engine_
->
precision
()
==
AnalysisConfig
::
Precision
::
kInt8
&&
platform
::
GetGPUComputeCapability
(
0
)
>=
75
)
{
platform
::
GetGPUComputeCapability
(
platform
::
GetCurrentDeviceId
())
>=
75
)
{
if
(
engine_
->
with_dynamic_shape
())
{
VLOG
(
3
)
<<
"Convert a fluid matmul_op_int8_dynamic to TensorRT "
"MatmulPluginLayer"
;
...
...
paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc
浏览文件 @
cb7f736f
...
...
@@ -88,11 +88,10 @@ class MultiheadMatMulOpConverter : public OpConverter {
engine_
->
tensorrt_transformer_posid
()
!=
""
&&
engine_
->
tensorrt_transformer_maskid
()
!=
""
;
if
(
engine_
->
with_dynamic_shape
())
{
if
(
engine_
->
tensorrt_transformer_maskid
()
!=
""
)
{
if
(
engine_
->
precision
()
==
AnalysisConfig
::
Precision
::
kFloat32
)
{
PADDLE_THROW
(
platform
::
errors
::
Fatal
(
"use use_varseqlen must be int8 or half, not float32."
));
}
if
(
engine_
->
tensorrt_transformer_maskid
()
!=
""
&&
engine_
->
precision
()
!=
AnalysisConfig
::
Precision
::
kFloat32
&&
platform
::
GetGPUComputeCapability
(
platform
::
GetCurrentDeviceId
())
>=
75
)
{
nvinfer1
::
Weights
weight
{
nvinfer1
::
DataType
::
kFLOAT
,
static_cast
<
void
*>
(
weight_data
),
static_cast
<
int32_t
>
(
weight_t
->
numel
())};
...
...
@@ -401,7 +400,8 @@ class MultiheadMatMulOpConverter : public OpConverter {
}
else
{
if
(
input_dims
.
d
[
1
]
<=
384
&&
!
bias_qk_attr
&&
engine_
->
precision
()
!=
AnalysisConfig
::
Precision
::
kFloat32
&&
platform
::
GetGPUComputeCapability
(
0
)
>=
75
)
{
platform
::
GetGPUComputeCapability
(
platform
::
GetCurrentDeviceId
())
>=
75
)
{
/*
* input_dims.d[0]: batch(-1)
* input_dims.d[1]: length:256
...
...
paddle/fluid/inference/tensorrt/plugin/CMakeLists.txt
浏览文件 @
cb7f736f
...
...
@@ -39,12 +39,12 @@ list(
generic_plugin.cu
lookup_table.cu
many_emb_layernorm_plugin.cu
many_emb_
L
ayernorm_kernel.cu
)
many_emb_
l
ayernorm_kernel.cu
)
if
(
${
TENSORRT_MAJOR_VERSION
}
GREATER_EQUAL 7
)
list
(
APPEND TRT_FILES many_emb_layernorm_varseqlen_plugin.cu
many_emb_
L
ayernorm_varseqlen_kernel_mtron.cu
many_emb_
L
ayernorm_varseqlen_kernel_hface.cu
)
many_emb_
l
ayernorm_varseqlen_kernel_mtron.cu
many_emb_
l
ayernorm_varseqlen_kernel_hface.cu
)
endif
()
if
(
CUSPARSELT_FOUND AND
${
TENSORRT_MAJOR_VERSION
}
GREATER_EQUAL 8
)
...
...
paddle/fluid/inference/tensorrt/plugin/many_emb_
L
ayernorm_kernel.cu
→
paddle/fluid/inference/tensorrt/plugin/many_emb_
l
ayernorm_kernel.cu
浏览文件 @
cb7f736f
文件已移动
paddle/fluid/inference/tensorrt/plugin/many_emb_
L
ayernorm_varseqlen_kernel_hface.cu
→
paddle/fluid/inference/tensorrt/plugin/many_emb_
l
ayernorm_varseqlen_kernel_hface.cu
浏览文件 @
cb7f736f
文件已移动
paddle/fluid/inference/tensorrt/plugin/many_emb_
L
ayernorm_varseqlen_kernel_mtron.cu
→
paddle/fluid/inference/tensorrt/plugin/many_emb_
l
ayernorm_varseqlen_kernel_mtron.cu
浏览文件 @
cb7f736f
文件已移动
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_serialize_deserialize_test.h
浏览文件 @
cb7f736f
...
...
@@ -139,6 +139,8 @@ static void trt_ernie(bool with_fp16, std::vector<float> result) {
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
5
,
precision
,
true
,
false
);
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
opt_input_shape
);
paddle_infer
::
experimental
::
InternalUtils
::
SetTransformerMaskid
(
&
config
,
"read_file_0.tmp_4"
);
AnalysisConfig
*
config_deser
=
new
AnalysisConfig
(
config
);
std
::
vector
<
float
>
out_data
;
...
...
paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc
浏览文件 @
cb7f736f
...
...
@@ -133,6 +133,8 @@ void trt_ernie(bool with_fp16,
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
5
,
precision
,
false
,
false
);
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
opt_input_shape
);
paddle_infer
::
experimental
::
InternalUtils
::
SetTransformerMaskid
(
&
config
,
"read_file_0.tmp_4"
);
std
::
vector
<
float
>
out_data
;
run
(
config
,
&
out_data
,
batch_size
);
...
...
@@ -423,7 +425,7 @@ void run(paddle_infer::Predictor* predictor, std::vector<float>* out_data) {
TEST
(
AnalysisPredictor
,
ernie_varlen
)
{
#if IS_TRT_VERSION_GE(7234)
if
(
platform
::
GetGPUComputeCapability
(
0
)
>=
75
)
{
if
(
platform
::
GetGPUComputeCapability
(
platform
::
GetCurrentDeviceId
()
)
>=
75
)
{
auto
predictor
=
InitPredictor
();
std
::
vector
<
float
>
out_data
;
run
(
predictor
.
get
(),
&
out_data
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录