Skip to content
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

Support static graph code-gen for yolo_loss #52946

Merged
merged 10 commits into from
May 10, 2023
Merged

Conversation

sanbuphy
Copy link
Contributor

@sanbuphy sanbuphy commented Apr 15, 2023

PR types

Others

PR changes

Others

Description

#51842

@paddle-bot
Copy link

paddle-bot bot commented Apr 15, 2023

你的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.

kernel :
func : yolo_loss
data_type : x
optional : gt_score
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加

intermediate : objectness_mask, gt_match_mask

修改ops.py中的195行

loss, _, _ = _C_ops.yolo_loss(

修改为:

loss = _C_ops.yolo_loss(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问研发大哥这个是怎么发现的?我看log就看不出来

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是由于intermediate : objectness_mask, gt_match_mask,这个配置对应xxxop.cc中的intermediate属性,表示这个output只会在grad中使用,不需要真正的输出。动态图的api配置了这个属性后,对应的output旧不会return了

@sanbuphy sanbuphy requested a review from heavyrain-lzy April 18, 2023 06:24
@heavyrain-lzy
Copy link
Contributor

解决一下冲突

@heavyrain-lzy
Copy link
Contributor

请解一下冲突

@sanbuphy
Copy link
Contributor Author

请解一下冲突

好的,最近业务比较繁忙,我中午or下午解一下

@@ -2048,3 +2048,13 @@
kernel :
func : where_grad
no_need_buffer : x, y

- backward_op : yolo_loss_grad
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy_backward.yaml中的yolo_loss_grad是不是没有删除,ci-py3编译信息显示重定义了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实= = 估计解冲突的时候搞挂了

@sanbuphy sanbuphy requested a review from heavyrain-lzy April 22, 2023 09:37
phi::KernelKey GetExpectedKernelType(
const framework::ExecutionContext& ctx) const override {
return phi::KernelKey(OperatorWithKernel::IndicateVarDataType(ctx, "X"),
platform::CPUPlace());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个GetExpectedKernelType目前看跟自动生成的有区别,需要手动生成,需要如下工作:

  1. op_compat.yaml中配置get_expected_kernel_type : yolo_loss : GetYoloLossExpectedKernelType
    2.在get_expected_kernel_func.cc增加对应的函数:
phi::KernelKey GetYoloLossExpectedKernelType(
      const framework::ExecutionContext& ctx,
      const framework::OperatorWithKernel* op_ptr)  {
    return phi::KernelKey(op_ptr->IndicateVarDataType(ctx, "X"),
                          platform::CPUPlace());

get_expected_kernel_func.h增加相应的声明

phi::KernelKey GetYoloLossExpectedKernelType(
      const framework::ExecutionContext& ctx,
      const framework::OperatorWithKernel* op_ptr);

可以参考frobenius_norm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

收到,我修改一下

@sanbuphy sanbuphy requested a review from heavyrain-lzy April 26, 2023 04:55
heavyrain-lzy
heavyrain-lzy previously approved these changes Apr 28, 2023
Copy link
Contributor

@heavyrain-lzy heavyrain-lzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1
Copy link
Contributor

luotao1 commented Apr 28, 2023

@sanbuphy 需要解决下冲突

@heavyrain-lzy
Copy link
Contributor

rerun一下相关CI,可能是随机挂

@luotao1
Copy link
Contributor

luotao1 commented May 9, 2023

rerun一下相关CI,可能是随机挂

已经 rerun,请 @heavyrain-lzy 再看下

heavyrain-lzy
heavyrain-lzy previously approved these changes May 9, 2023
Copy link
Contributor

@heavyrain-lzy heavyrain-lzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1
Copy link
Contributor

luotao1 commented May 9, 2023

@sanbuphy 请解决下冲突

@luotao1 luotao1 merged commit 3be7a6c into PaddlePaddle:develop May 10, 2023
@sanbuphy sanbuphy deleted the lossop branch December 28, 2023 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants