Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

【Hackathon 6th No.5】Add chi2/LKJCholesky API to Paddle

Open cmcamdy opened this issue 10 months ago • 5 comments

PR Category

Others

PR Types

Others

Description

需要为飞桨扩充 API paddle.distribution.chi2 和 paddle.distribution.LKJCholesky 1.实现分布chi2 2.实现分布LKJCholesky,支持sample_method参数,onion/cvine可选

cmcamdy avatar Apr 25 '24 17:04 cmcamdy

你的PR提交成功,感谢你对开源项目的贡献! 请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。 Your PR has been submitted. Thanks for your contribution! Please wait for the result of CI firstly. See Paddle CI Manual for details.

paddle-bot[bot] avatar Apr 25 '24 17:04 paddle-bot[bot]

Sorry to inform you that 1269701's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

paddle-ci-bot[bot] avatar May 04 '24 03:05 paddle-ci-bot[bot]

@lxd-cumt 这里还有一些静态check需要approve,麻烦看下

cmcamdy avatar May 14 '24 14:05 cmcamdy

这里还有一些静态check需要approve,麻烦看下

这个最后我们会统一处理

luotao1 avatar May 15 '24 02:05 luotao1

https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/dev_guides/code_contributing_path_cn.html#span-id-codereview-code-review-span image

@cmcamdy 评审人的每条意见都需要回复

luotao1 avatar May 17 '24 06:05 luotao1

https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/dev_guides/code_contributing_path_cn.html#span-id-codereview-code-review-span image

@cmcamdy 评审人的每条意见都需要回复

好的好的,感谢提醒

cmcamdy avatar May 20 '24 12:05 cmcamdy

这里还有一些静态check需要approve,麻烦看下

这个最后我们会统一处理

好的

cmcamdy avatar May 20 '24 12:05 cmcamdy

不好意思,不知道为啥没有显示 image

我应该有回答这两个问题,我粘过来: Q1: 这部分测试是和gamma一致的(指gamma这里的测试设置的也是0.1),chi2就是gamma的变种,我理解和gamma保持一致即可 https://github.com/PaddlePaddle/Paddle/blob/62bbc39e9ab70ed97ef53413f29a97b2982550c5/test/deprecated/distribution/test_distribution_gamma_static.py#L292 Q2:有的,本地可以过的,但是CI超时了(指超过15s)。如果有需要我可以加回去,就是不保证在15s内完成

cmcamdy avatar May 20 '24 12:05 cmcamdy

不好意思,不知道为啥没有显示

你看看你的评论是不是 pending 状态,需要提交

本地可以过的,但是CI超时了(指超过15s)

单测验收规范 有说明 image

luotao1 avatar May 21 '24 03:05 luotao1

不好意思,不知道为啥没有显示 image

我应该有回答这两个问题,我粘过来: Q1: 这部分测试是和gamma一致的(指gamma这里的测试设置的也是0.1),chi2就是gamma的变种,我理解和gamma保持一致即可

https://github.com/PaddlePaddle/Paddle/blob/62bbc39e9ab70ed97ef53413f29a97b2982550c5/test/deprecated/distribution/test_distribution_gamma_static.py#L292

Q2:有的,本地可以过的,但是CI超时了(指超过15s)。如果有需要我可以加回去,就是不保证在15s内完成

1.rtol和gamma保持一致,在对应地方补上注释。 2.单测应该加上,设置下单测时间,并在PR的 Description 中说明下运行时间较长的原因。

xuxinyi389 avatar May 21 '24 03:05 xuxinyi389

Description

那请问CI中超过15s失败了这个怎么解决?有什么特殊设置可以暂时通过吗?

cmcamdy avatar May 21 '24 13:05 cmcamdy

Description

那请问CI中超过15s失败了这个怎么解决?有什么特殊设置可以暂时通过吗?

在对应的camke中为特定单测设置,语法: set_tests_properties(单测名 PROPERTIES TIMEOUT 时间) ,

xuxinyi389 avatar May 22 '24 02:05 xuxinyi389

Sorry to inform you that 65f6cdb's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

paddle-ci-bot[bot] avatar May 23 '24 03:05 paddle-ci-bot[bot]

Description

那请问CI中超过15s失败了这个怎么解决?有什么特殊设置可以暂时通过吗?

在对应的camke中为特定单测设置,语法: set_tests_properties(单测名 PROPERTIES TIMEOUT 时间) ,

谢谢,已修改,pr的Description中加上了相应的说明

cmcamdy avatar May 24 '24 02:05 cmcamdy

感谢您的指出,这个确实是个问题,目前chi2这边参照gamma中的示例加上了相应的类型检查

cmcamdy avatar May 24 '24 10:05 cmcamdy

参考下这个PR,补充下单测,比如一些不合理的输入。https://github.com/PaddlePaddle/Paddle/pull/64294/files#diff-624ec68adbd3ef1f861ad55720efde0303a044025b1229d7ec712af2574f081e image

xuxinyi389 avatar May 27 '24 06:05 xuxinyi389

参考下这个PR,补充下单测,比如一些不合理的输入。https://github.com/PaddlePaddle/Paddle/pull/64294/files#diff-624ec68adbd3ef1f861ad55720efde0303a044025b1229d7ec712af2574f081e image

已经为chi2和lkj两个分布新增负样本测试

cmcamdy avatar May 27 '24 17:05 cmcamdy

已经为chi2和lkj两个分布新增负样本测试

需要通过流水线

luotao1 avatar May 28 '24 03:05 luotao1

LGTM

xuxinyi389 avatar May 29 '24 03:05 xuxinyi389

已经为chi2和lkj两个分布新增负样本测试

需要通过流水线

嗯嗯目前还剩下俩,看起来需要同学手动通过

cmcamdy avatar May 31 '24 02:05 cmcamdy

please add link of rfc in description above.

jeff41404 avatar May 31 '24 02:05 jeff41404

except __init__, shall we need method of expand?

sry, I'm not quite sure about the role/function of the expand method. Can you describe it to me? I haven't found a specifically implemented expand method among the distribution.

cmcamdy avatar Jun 01 '24 13:06 cmcamdy

please add link of rfc in description above.

done.

cmcamdy avatar Jun 01 '24 13:06 cmcamdy

@cmcamdy 关于expand的问题,comment by @jeff41404

pytorch 中有expand方法,我们是否需要,设计文档中也没有说明,如果不需要,代码转换时如何替代

luotao1 avatar Jun 03 '24 07:06 luotao1

@cmcamdy 关于expand的问题,comment by @jeff41404

pytorch 中有expand方法,我们是否需要,设计文档中也没有说明,如果不需要,代码转换时如何替代

我明白了,实际上pytorch中的extend是对batch维度的扩展,如gamma中的实现:https://github.com/pytorch/pytorch/blob/e3ac61587aa368c613ef01df1f328a396b64cd5d/torch/distributions/gamma.py#L60 这部分逻辑paddle中并没有专门实现(因此在设计的时候并没有计划实现expand类的方法),但在如果想要等价实现,只需要在初始化的时候传入带batch的参数即可,我们在sample中会考虑多维shape的情况

I see, in PyTorch, the expand functionality is actually used to extend the batch dimension, as exemplified in the Gamma distribution implementation: https://github.com/pytorch/pytorch/blob/e3ac61587aa368c613ef01df1f328a396b64cd5d/torch/distributions/gamma.py#L60 PaddlePaddle doesn't have a dedicated implementation for this specific logic (indicating that it wasn't planned as part of the original design to include an expand-like method). However, to achieve an equivalent functionality in PaddlePaddle, one can simply pass batch-aware parameters during initialization. When sampling, we will take into account multi-dimensional shapes.

cmcamdy avatar Jun 03 '24 13:06 cmcamdy

@cmcamdy 关于expand的问题,comment by @jeff41404 pytorch 中有expand方法,我们是否需要,设计文档中也没有说明,如果不需要,代码转换时如何替代

我明白了,实际上pytorch中的extend是对batch维度的扩展,如gamma中的实现:https://github.com/pytorch/pytorch/blob/e3ac61587aa368c613ef01df1f328a396b64cd5d/torch/distributions/gamma.py#L60 这部分逻辑paddle中并没有专门实现(因此在设计的时候并没有计划实现expand类的方法),但在如果想要等价实现,只需要在初始化的时候传入带batch的参数即可,我们在sample中会考虑多维shape的情况

I see, in PyTorch, the expand functionality is actually used to extend the batch dimension, as exemplified in the Gamma distribution implementation: https://github.com/pytorch/pytorch/blob/e3ac61587aa368c613ef01df1f328a396b64cd5d/torch/distributions/gamma.py#L60 PaddlePaddle doesn't have a dedicated implementation for this specific logic (indicating that it wasn't planned as part of the original design to include an expand-like method). However, to achieve an equivalent functionality in PaddlePaddle, one can simply pass batch-aware parameters during initialization. When sampling, we will take into account multi-dimensional shapes.

ok, thanks

jeff41404 avatar Jun 05 '24 02:06 jeff41404

@luotao1 , 我重启了下APPROVAL的CI,似乎还需要下面几位同学的approve,这个CI里面的报错提示如下: 2024-06-05 11:28:16 0. You must have raindrops2sea or XiaoguangHu01 approval for change 20+ files or add than 1000+ lines of content. 2024-06-05 11:28:16 1. You must have one QA (XieYunshen(Recommend) or chalsliu) approval for setting parameter RUN_TYPE as EXCLUSIVE, DIST, HYBRID, NIGHTLY, EXCLUSIVE:NIGHTLY or DISTNIGHTLY, or setting parameter SERIAL, or setting TIMEOUT properties.

cmcamdy avatar Jun 05 '24 03:06 cmcamdy

Approval 流水线我们会来操作,请耐心等待 review 即可

luotao1 avatar Jun 05 '24 03:06 luotao1

Sorry to inform you that fe3edf2's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

paddle-ci-bot[bot] avatar Jun 09 '24 03:06 paddle-ci-bot[bot]

已修改

cmcamdy avatar Jun 12 '24 01:06 cmcamdy