Skip to content

飞桨框架API易用性提升开源任务 #55883

Closed

Description

@zhwesky2010

✨ 整体背景:

大家好,为了提升模型迁移的效率,我们建设了 代码自动转换工具: PaddlePaddle Code Convert Toolkits,为了降低 代码自动转换工具 中转换规则Matcher的开发难度,我们需要对部分框架API的功能和易用性进行增强。

🍻 你需要做的是:

我们已将任务记录在《在线任务明细表》,一共55个任务,其中 问题描述 这一列阐述了当前Paddle API的问题;修改方案 这一列阐述了该API的升级修改思路,即你需要开发的内容;预计成本 这一列阐述了该任务的预估难度及成本。大家可根据这三列信息,来评估和选择自己适合的任务,并自由认领任务,认领时直接在本issue下回复 任务ID 即可,欢迎大家来认领任务和提PR ~

✨ 注意:

  1. 该任务时间:PR 截止合入时间是2024/3/31。

  2. 开发流程与Paddle代码贡献流程完全一致,可参考Paddle官网文档:代码贡献流程

  3. API修改时,请注意同时修改 API中文文档(位于doc repo中)、API英文文档。

  4. PR请先通过CI检查后再发起review,避免增加不必要的review成本。

  5. PR标题格式:No.1~35 paddle.xxx易用性提升,PR描述需要附上本issue,在提交PR后我们会内部指派reviewer,由该reviewer负责合入。

  6. 历史上的 good first issue 列表,也欢迎来提 PR 解决~ 欢迎联系花花加入社区,和我们一起快乐开源!

image


Overall Background:

Hello everyone, in order to improve the efficiency of model migration, we have built a code auto-conversion tool: PaddlePaddle Code Convert Toolkits. To reduce the development difficulty of conversion rules Matcher in the code auto-conversion tool, we need to enhance the functionality and usability of some framework APIs.

What You Need to Do:

We have recorded the tasks in the Online Task Details, totaling 35 tasks. The "Issue" column explains the current issues with the Paddle API, the "Solution" column outlines the upgrade and modification approach for that API, which is what you need to develop. The "Workload Estimate" column describes the estimated difficulty and cost of the task. You can evaluate and choose tasks that suit you based on these three columns and freely claim tasks. When claiming a task, simply reply with the task ID in this issue. Welcome everyone to claim tasks and submit PRs~

Note:

  1. The deadline for this task: The PR deadline for merging is October 31, 2023.
  2. The development process is completely consistent with the Paddle code contribution process. You can refer to the Paddle official website documentation: Code Contribution Process.
  3. When modifying APIs, please remember to update the API Chinese documentation (located in the doc repo) and API English documentation at the same time.
  4. Please initiate a review only after passing the CI checks to avoid unnecessary review costs.
  5. PR Title Format: No.1~35 paddle.xxx usability improvement. PR descriptions should include a reference to this issue. After submitting a PR, we will internally assign a reviewer responsible for merging.
  6. List of historical good first issues is also welcome for PR solutions~ Feel free to contact Hua Hua to join the community and enjoy open source together!

Activity

  1. changed the title [-]飞桨API易用性提升: paddle.diff[/-] [+]飞桨框架API易用性提升开源任务[/+] on Aug 2, 2023
  2. zhwesky2010 commented on Aug 2, 2023

    @zhwesky2010
    ContributorAuthor

    🍻 任务列表(整体进度 8/34)

    按 merge 的时间顺序,排名不分先后: @XavierZXY (1) @Liyulingyue (1) @enkilee (1) @YibinLiu666 (4)

    任务 ID 认领人 Github Paddle PR 链接 中文文档 链接(如有)
    01 ✅(2023/8/29) @XavierZXY #56681 #56736 PaddlePaddle/docs#6148
    02
    03✅(2023/8/29) @Liyulingyue #56470 #56728 PaddlePaddle/docs#6147
    04
    05✅(2023/10/17) @enkilee #56761
    06✅ 验证后发现是参数的随机初始化导致结果不同,无需修改
    07✅(2023/12/22) @YibinLiu666 #60084 PaddlePaddle/docs#6415
    08
    09✅(2023/11/13) @YibinLiu666 #58632 PaddlePaddle/docs#6291
    10 @YibinLiu666
    11
    12
    13
    14 @YibinLiu666
    15
    16
    17
    18
    19
    20
    21 @YibinLiu666 #60275
    22
    23
    24
    25
    26
    27✅(2023/12/4) @YibinLiu666 #59163 ✅
    28
    29
    30
    31
    32
    33 ✅(2023/12/19) @YibinLiu666 #60054
    34
  3. moved this to In Progress in Call for Contributionson Aug 3, 2023
  4. GreatV commented on Aug 5, 2023

    @GreatV
    Collaborator

    @snorfyang 任务明细表还没更新,估计还需要一段时间。

  5. zhwesky2010 commented on Aug 17, 2023

    @zhwesky2010
    ContributorAuthor

    在线任务明细表链接是不是错了 @zhwesky2010

    你好,已更新在线任务明细表

  6. 28 remaining items

  7. YibinLiu666 commented on Nov 15, 2023

    @YibinLiu666
    Contributor

    任务 No.35 中的问题: paddle pool 的gpu实现是调用的cudnn接口,但是cudnn中的pool没有dilation这个参数

    pool的GPU算子实现,是自行编写的cuda 核函数,这个在哪里看到的cudnn调用呢?如果是自行编写的cuda函数,就可以自定义的修改增强逻辑了。

    我看maxpool调用的c op是在https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/api/yaml/legacy_ops.yaml 这个里面定义的pool2d,然后我看https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/kernels/pool_kernel.h 里面有个Pool2dGPUDNNKernel的接口也被注册到pool2d,这个实现是用cudnn实现的。

  8. YibinLiu666 commented on Nov 15, 2023

    @YibinLiu666
    Contributor

    认领43、51

  9. zhwesky2010 commented on Nov 16, 2023

    @zhwesky2010
    ContributorAuthor

    任务 No.35 中的问题: paddle pool 的gpu实现是调用的cudnn接口,但是cudnn中的pool没有dilation这个参数

    pool的GPU算子实现,是自行编写的cuda 核函数,这个在哪里看到的cudnn调用呢?如果是自行编写的cuda函数,就可以自定义的修改增强逻辑了。

    我看maxpool调用的c op是在https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/api/yaml/legacy_ops.yaml 这个里面定义的pool2d,然后我看https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/kernels/pool_kernel.h 里面有个Pool2dGPUDNNKernel的接口也被注册到pool2d,这个实现是用cudnn实现的。

    这个API有CPU、GPU(不适用cudnn)、GPUDNN(使用cudnn)的算子、XPU算子,使用cudnn应该也有办法实现,是将stride、dilation多个参数加工处理后,最终调用的cudnn接口。

  10. YibinLiu666 commented on Nov 16, 2023

    @YibinLiu666
    Contributor

    任务 No.35 中的问题: paddle pool 的gpu实现是调用的cudnn接口,但是cudnn中的pool没有dilation这个参数

    pool的GPU算子实现,是自行编写的cuda 核函数,这个在哪里看到的cudnn调用呢?如果是自行编写的cuda函数,就可以自定义的修改增强逻辑了。

    我看maxpool调用的c op是在https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/api/yaml/legacy_ops.yaml 这个里面定义的pool2d,然后我看https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/phi/kernels/pool_kernel.h 里面有个Pool2dGPUDNNKernel的接口也被注册到pool2d,这个实现是用cudnn实现的。

    这个API有CPU、GPU(不适用cudnn)、GPUDNN(使用cudnn)的算子、XPU算子,使用cudnn应该也有办法实现,是将stride、dilation多个参数加工处理后,最终调用的cudnn接口。

    好的,我再想一下怎么加工处理

  11. YibinLiu666 commented on Nov 16, 2023

    @YibinLiu666
    Contributor

    关于问题43的问题:
    在修复此问题的bug时发现paddle的take_along_axis与torch的gather行为也不一致,不一致的代码如下:
    import torch
    t = torch.tensor([[1, 2], [3, 4]])
    i=torch.tensor([[1]])
    result = torch.gather(t,1,i)
    torch对应的输出是tensor([[2]]),而paddle输出结果是
    Tensor(shape=[2, 1], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[2], [4]])
    在完成该任务时需要一起解决吗

  12. zhwesky2010 commented on Nov 17, 2023

    @zhwesky2010
    ContributorAuthor

    关于问题43的问题: 在修复此问题的bug时发现paddle的take_along_axis与torch的gather行为也不一致,不一致的代码如下: import torch t = torch.tensor([[1, 2], [3, 4]]) i=torch.tensor([[1]]) result = torch.gather(t,1,i) torch对应的输出是tensor([[2]]),而paddle输出结果是 Tensor(shape=[2, 1], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[2], [4]]) 在完成该任务时需要一起解决吗

    @YibinLiu666 需要一起解决的,应该是之前没有扫描到。

  13. Olive-2019 commented on Nov 28, 2023

    @Olive-2019

    关于任务27、28的问题:
    任务27:paddle不支持remove_duplicate,但是支持逻辑几乎一样的 include_sublayers
    任务28:paddle不支持memo,但是支持逻辑几乎一样的 layers_set

    解决方案:

    1. 忽略该意见
    2. 在文档中补充paddle参数和pytorch参数的等价关系(建议)
    3. 参数改名(不建议,这样之前的用户需要修改代码)
    4. 加入memo与remove_duplicate参数,保持与include_sublayers和layers_set的逻辑同步,允许使用pytorch的同名参数(不太建议,加入冗余代码)

    请问这两个任务采取哪种解决方案?

  14. zhwesky2010 commented on Nov 29, 2023

    @zhwesky2010
    ContributorAuthor

    关于任务27、28的问题: 任务27:paddle不支持remove_duplicate,但是支持逻辑几乎一样的 include_sublayers 任务28:paddle不支持memo,但是支持逻辑几乎一样的 layers_set

    解决方案:

    1. 忽略该意见
    2. 在文档中补充paddle参数和pytorch参数的等价关系(建议)
    3. 参数改名(不建议,这样之前的用户需要修改代码)
    4. 加入memo与remove_duplicate参数,保持与include_sublayers和layers_set的逻辑同步,允许使用pytorch的同名参数(不太建议,加入冗余代码)

    请问这两个任务采取哪种解决方案?

    建议要拿torch代码测试一下,是否完全一致,如果完全一致或者有简单的转写方式,则不需要调整API,写入映射文档中即可。如果差异很大,则需要扩充API的功能才可支持转写。

  15. YibinLiu666 commented on Dec 13, 2023

    @YibinLiu666
    Contributor

    第6题中 paddle.nn.functional.triplet_margin_with_distance_loss 与torch中不一样的复现代码能否提供一下

  16. zhwesky2010 commented on Dec 14, 2023

    @zhwesky2010
    ContributorAuthor

    第6题中 paddle.nn.functional.triplet_margin_with_distance_loss 与torch中不一样的复现代码能否提供一下

    你好,这个验证后发现是参数的随机初始化导致结果不同,无需修改,关闭任务。

  17. YibinLiu666 commented on Dec 15, 2023

    @YibinLiu666
    Contributor

    认领7、10、14、21

  18. moved this from In Progress to Hold in Call for Contributionson Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions