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

[Dy2St] pir dy2st unittest verification - Part 8 #59120

Merged
merged 11 commits into from
Nov 22, 2023

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Nov 18, 2023

PR types

Others

PR changes

Others

Description

状态 单测 错误类别 备注 报错信息
🚧 test_cache_program:TestToOutputWithCache 控制流 需要适配paddle.static.nn.control_flow.While._complete方法,WhileGuard 报错 ValueError: (InvalidArgument) Currently, we can only get name of OpResult that is persistable
test_resnet 反向 InvalidArgumentError: The type of data we are trying to retrieve (uint8) does not match the type of data (float32) currently contained in the container.
test_rollback 需要确认一下我们在生成新方法的时候setUP中设置的device是否生效, 原因Part 3
test_backward_without_params
test_for_enumerate: TestForInRange 控制流 控制流 While ValueError: (InvalidArgument) Currently, we can only get name of OpResult that is persistable (at /workspace/Paddle/paddle/fluid/pybind/pir.cc:745)
test_for_enumerate: TestForIterVarNumpy API 需要支持OpResult.clone,依赖 #59115 AttributeError: 'paddle.base.libpaddle.pir.OpResult' object has no attribute 'clone'
test_for_enumerate: TestForInRange 控制流 While 控制流 ValueError: (InvalidArgument) Currently, we can only get name of OpResult that is persistable (at /workspace/Paddle/paddle/fluid/pybind/pir.cc:745)
test_for_enumerate: TestForZip API Save Load 不支持
test_for_enumerate: TestForIterVarList API & 控制流 OpResult 没有 append
test_print 依赖已解,可以启用

中间态问题记录:

test/dygraph_to_static/test_for_enumerate.py文件的TestForInRange.test_transformed_result_compare单测,需要装饰@test_pir_only复现 (注意有部分单测继承它)

报错信息:

/Users/gouzi/miniconda3/envs/py311/lib/python3.11/site-packages/paddle/base/framework.py:3011: UserWarning: The Attr(force_cpu) of Op(fill_constant) will be deprecated in the future, please use 'device_guard' instead. 'device_guard' has higher priority when they are used at the same time.
  warnings.warn(
/Users/gouzi/miniconda3/envs/py311/lib/python3.11/site-packages/paddle/tensor/creation.py:2402: UserWarning: paddle.assign doesn't support float64 input now due to current platform protobuf data limitation, we convert it to float32
  warnings.warn(
/Users/gouzi/miniconda3/envs/py311/lib/python3.11/site-packages/paddle/static/nn/control_flow.py:596: UserWarning: In dy2static mode, we attemp to assign a variable with shape () into a variable with shape(1,), which is not always right.
  warnings.warn(
Error occured at: /Users/gouzi/Documents/git/Paddle/paddle/fluid/ir_adaptor/translator/op_translator.cc:540 :
Op lod_array_length arg out should be optional if it can be empty
libc++abi: terminating due to uncaught exception of type pir::IrNotMetException: Error occured at: /Users/gouzi/Documents/git/Paddle/paddle/fluid/ir_adaptor/translator/op_translator.cc:540 :
Op lod_array_length arg out should be optional if it can be empty
[1]    25806 abort      python test_for_enumerate.py

相关链接:

Copy link

paddle-bot bot commented Nov 18, 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 18, 2023
Copy link

paddle-bot bot commented Nov 18, 2023

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@gouzil gouzil requested a review from SigureMo November 19, 2023 11:25
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

一些修改注解,@gouzil @DrRyanHuang 可以看看

@@ -575,8 +575,24 @@ def convert_len(var):
'len(var) only supports LoDTensor/LoDTensorArray/SelectedRows, but received %s.'
% type(var)
)
elif isinstance(var, OpResult):
Copy link
Member

Choose a reason for hiding this comment

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

适配 convert_len

OpResult 上需要用 is_dense_tensor_array_type 等方法来判断 type

if len(args) == 3:
return paddle.arange(args[0], args[1], args[2], paddle.int64)
return paddle.arange(args[0], args[1], args[2], "int64")
Copy link
Member

Choose a reason for hiding this comment

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

适配 convert_range

目前 PIR API 不支持 VarType,但支持 str,与震哥同步是将来会通过将 paddle.int64 这些 API 在 pir mode 下直接改为 DataType 来实现,但这件事情目前还没有排期

目前的解决方案就是遇到相关代码就改为 str

# TODO(dev): Remove the program and var_cache shims after PIR become default state.
# self.var_cache = {}
# self.main_program = paddle.static.Program()
# self.startup_program = paddle.static.Program()
Copy link
Member

Choose a reason for hiding this comment

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

利用底层 @cached_property 做 lazy initialize,顶层 @property 来按照 ir mode 分发,确保 cache 的属性在不同模式下是不同的

相关代码都是冗余代码,在老 IR 退场后可以直接写回注释中的版本

@gouzil gouzil deleted the dy2st_pir_api_push_8 branch December 27, 2023 02:36
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.

3 participants