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

【PIR API adaptor No.222】Migrate paddle.nn.SyncBatchNorm into pir #59077

Merged
merged 4 commits into from
Nov 23, 2023

Conversation

xiaoyewww
Copy link
Contributor

@xiaoyewww xiaoyewww commented Nov 16, 2023

PR types

Others

PR changes

APIs

Description

#58067
No.222 paddle.nn.SyncBatchNorm
PIR API 推全升级

将 paddle.nn.SyncBatchNorm 迁移升级至 pir,并更新单测 单测覆盖率:3/4
TestSyncBatchNormOpTraining测试比较复杂无法直接适配pir,暂时没有适配

存在问题:

2023-11-21 05:27:45 test_sync_batch_norm_op failed
2023-11-21 05:27:45  ss..E.....
2023-11-21 05:27:45 ======================================================================
2023-11-21 05:27:45 ERROR: test_errors (test_sync_batch_norm_op.TestDygraphSyncBatchNormAPIError)
2023-11-21 05:27:45 ----------------------------------------------------------------------
2023-11-21 05:27:45 Traceback (most recent call last):
2023-11-21 05:27:45   File "/paddle/build/python/paddle/pir_utils.py", line 115, in impl
2023-11-21 05:27:45     func(*args, **kwargs)
2023-11-21 05:27:45   File "/mnt/paddle/build/test/legacy_test/test_sync_batch_norm_op.py", line 376, in test_errors
2023-11-21 05:27:45     self.assertRaises(TypeError, my_sync_batch_norm, x1)
2023-11-21 05:27:45   File "/usr/local/lib/python3.8/unittest/case.py", line 816, in assertRaises
2023-11-21 05:27:45     return context.handle('assertRaises', args, kwargs)
2023-11-21 05:27:45   File "/usr/local/lib/python3.8/unittest/case.py", line 202, in handle
2023-11-21 05:27:45     callable_obj(*args, **kwargs)
2023-11-21 05:27:45   File "/paddle/build/python/paddle/nn/layer/layers.py", line 1426, in __call__
2023-11-21 05:27:45     return self._dygraph_call_func(*inputs, **kwargs)
2023-11-21 05:27:45   File "/paddle/build/python/paddle/nn/layer/layers.py", line 1405, in _dygraph_call_func
2023-11-21 05:27:45     outputs = self.forward(*inputs, **kwargs)
2023-11-21 05:27:45   File "/paddle/build/python/paddle/nn/layer/norm.py", line 1627, in forward
2023-11-21 05:27:45     sync_batch_norm_out, _, _, _, _, _ = _C_ops.sync_batch_norm_(
2023-11-21 05:27:45 ValueError: 
2023-11-21 05:27:45 
2023-11-21 05:27:45 --------------------------------------
2023-11-21 05:27:45 C++ Traceback (most recent call last):
2023-11-21 05:27:45 --------------------------------------
2023-11-21 05:27:45 0   paddle::pybind::static_api_sync_batch_norm_(_object*, _object*, _object*)
2023-11-21 05:27:45 1   paddle::pybind::CastPyArg2Value(_object*, std::string const&, unsigned long)
2023-11-21 05:27:45 2   phi::enforce::EnforceNotMet::EnforceNotMet(phi::ErrorSummary const&, char const*, int)
2023-11-21 05:27:45 3   phi::enforce::GetCurrentTraceBackString[abi:cxx11](bool)
2023-11-21 05:27:45 
2023-11-21 05:27:45 ----------------------
2023-11-21 05:27:45 Error Message Summary:
2023-11-21 05:27:45 ----------------------
2023-11-21 05:27:45 InvalidArgumentError: sync_batch_norm_(): argument (position 1) must be OpResult, but got paddle.base.libpaddle.Tensor (at /paddle/paddle/fluid/pybind/eager_utils.cc:1925)

Copy link

paddle-bot bot commented Nov 16, 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.

@paddle-bot paddle-bot bot added the contributor External developers label Nov 16, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Nov 17, 2023
@xiaoyewww xiaoyewww changed the title 【PIR API adaptor No.222】Migrate paddle.nn.SyncBatchNorm into pir 【WIP】【PIR API adaptor No.222】Migrate paddle.nn.SyncBatchNorm into pir Nov 19, 2023
@xiaoyewww xiaoyewww changed the title 【WIP】【PIR API adaptor No.222】Migrate paddle.nn.SyncBatchNorm into pir 【PIR API adaptor No.222】Migrate paddle.nn.SyncBatchNorm into pir Nov 19, 2023
Copy link
Contributor

@MarioLulab MarioLulab left a comment

Choose a reason for hiding this comment

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

还遗漏了 test/legacy_test/test_sync_batch_norm_op.py 这个文件下的相关静态图单测~

@@ -359,12 +360,15 @@ def setUp(self):


class TestDygraphSyncBatchNormAPIError(unittest.TestCase):
@test_with_pir_api
Copy link
Contributor

Choose a reason for hiding this comment

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

看到 ci-coverage 挂在了这个地方。可以先取消 TestDygraphSyncBatchNormAPIError 单测的 pir 适配。并在 pr 描述里说明一下该单测暂不支持,并更新单测覆盖率

Copy link
Contributor Author

Choose a reason for hiding this comment

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

看到 ci-coverage 挂在了这个地方。可以先取消 TestDygraphSyncBatchNormAPIError 单测的 pir 适配。并在 pr 描述里说明一下该单测暂不支持,并更新单测覆盖率

已更新,麻烦review~

Copy link
Contributor

@MarioLulab MarioLulab left a comment

Choose a reason for hiding this comment

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

LGTM
在 pr 描述里写一下 TestSyncBatchNormOpTraining 暂时不适配,然后更新一下单测覆盖率

@0x45f 0x45f merged commit e1f3e75 into PaddlePaddle:develop Nov 23, 2023
28 checks passed
@xiaoyewww xiaoyewww deleted the new-ir/syncbn branch May 10, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants