-
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.46】为 Paddle gumbel_softmax 算子实现 float16 数据类型支持 #50923
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
index_sequence_begin + size, | ||
thrust::device_ptr<T>(random_data), | ||
UniformCUDAGenerator<T>(static_cast<phi::dtype::float16>(0.00001), | ||
static_cast<phi::dtype::float16>(1), |
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.
这里是否有修改的必要?无论T为何种类型,这里都cast到FP16
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.
done
self.count_expected = 100 | ||
self.dtype = np.float16 | ||
|
||
|
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.
FP16的单测需要参考低精度算子的单测规范进行修改:
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.
done
另外记得提交中文文档的修改PR,可以在这个PR说明中引用一下或者提交PR后assign给我,我会review |
@zhangting2020 老师您好,这是中文文档更新pr: PaddlePaddle/docs#5707 |
self.check_output() | ||
|
||
def test_check_grad(self): | ||
self.check_grad(["X"], "Out") |
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.
FP16的单测需要继承TestGumbelSoftmaxOp,实际上只需要为fp16的case重写init_attrs,可以减少冗余代码。
TestGumbelSoftmax_ZeroDim_FP16OP -> TestGumbelSoftmaxFP16OP
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.
老师,您好,这里是参考单测中原来写法。针对于ZeroDim单独继承optest进行测试,其余各test继承TestGumbelSoftmaxOp并重写init_attr()。我这里也是针对于ZeroDim单独处理了。所以直接继承了optest。后续四个test都是直接继承TestGumbelSoftmaxOp并重写init_attr()的。
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.
原始写法我想并不是最优的。TestGumbelSoftmax_ZeroDim里面其实重写init_attr也可以吧
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.
老师您好,我尝试了直接用TestGumbelSoftmax_ZeroDim继承TestGumbelSoftmaxOp基类,但是由于基类中check_out是针对多维重写的check_out_custormized,并不适用于ZeroDim。因此我在TestGumbelSoftmax_ZeroDim中添加了init_attr方法,并令TestGumbelSoftmax_ZeroDimFP16继承修改。
self.attrs = {"hard": True, "axis": 1} | ||
self.count_expected = 100 | ||
self.dtype = np.float16 | ||
|
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.
这4个单测继承TestGumbelSoftmaxFP16OP。
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.
您好,因为前面TestGumbelSoftmax_ZeroDim_FP16OP是针对于ZeroDim的,所以内部没有init_attrs()函数。无法更改名字为TestGumbelSoftmaxFP16OP。所以直接继承自TestGumbelSoftmaxOp。
|
已解决,参考 #51512 (comment) 。目前流水线已经是正常的了。 @denglianbin |
好的老师,已经重新跑了,最后报错是find RD for approval first了,应该是正常的了。 |
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
PR types
Others
PR changes
Others
Describe
性能数据(op benchmark)