-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Hackathon NO.76] 为 Paddle-TRT 添加elementwise_mod 算子 #50974
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
@@ -2415,6 +2415,7 @@ USE_TRT_CONVERTER(elementwise_max_tensor); | |||
USE_TRT_CONVERTER(elementwise_min_tensor); | |||
USE_TRT_CONVERTER(elementwise_pow_tensor); | |||
USE_TRT_CONVERTER(elementwise_floordiv_tensor); | |||
USE_TRT_CONVERTER(elementwise_mod_tensor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elementwise_mod_weight也添加上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加
@@ -791,6 +796,7 @@ def generate_weight(op_type): | |||
"elementwise_min", | |||
"elementwise_max", | |||
"elementwise_floordiv", | |||
"elementwise_mod", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前单测精度上有问题,coverage ci无法通过。可能是因为包含有floordiv,需要对对应的输入做修改,如generate_input或者generate_weight,由于np.random.random范围为[0,1.0), 需将np.random.random替换为np.random.uniform。
参考如下,
def generate_input(shape, op_type):
# elementwise_floordiv is integer only
if op_type == "elementwise_floordiv":
return np.random.randint(
low=1, high=10000, size=shape, dtype=np.int32
)
elif op_type == "elementwise_mod":
return np.random.uniform(low=0.1, high=1.0, size=shape).astype(np.float32)
else:
return np.random.random(shape).astype(np.float32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照您说的修改后 coverage ci 还是无法通过
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate_input或者generate_weight
看着还是有精度diff 是不是所有的generate_input或者generate_weight都需要修改,可以本地环境验证下(CUDA 10.2, TensorRT 7.2.3.4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看着还是有精度diff 是不是所有的generate_input或者generate_weight都需要修改,可以本地环境验证下(CUDA 10.2, TensorRT 7.2.3.4)
本地 cuda11.7 tensorrt 8.4 的环境可以吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看着还是有精度diff 是不是所有的generate_input或者generate_weight都需要修改,可以本地环境验证下(CUDA 10.2, TensorRT 7.2.3.4)
本地 cuda11.7 tensorrt 8.4 的环境可以吗
11.7可以作为辅助 建议在https://hub.docker.com/r/paddlepaddle/paddle下拉取10.2环境,当前未通过ci是10.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在本地的单测已经不报错了,线上的也没有出现上面的精度问题,但是报了一个本地没有出现过的错误
目前 TRT7, TRT8 本地环境验证正常 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
hi, @AndSonder
|
PR types
Others
PR changes
Others
Describe
使用已有 TensorRT 算子组合实现 elementwise_mod
没有新创建单测代码,在已有单测代码
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_elementwise.py
的基础上添加 elementwise_mod 的单测,已通过单测,测试截图如下: