Skip to content

[Dy2St] Record patched name to avoid rollback failures #69940

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

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Dec 4, 2024

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

SOT layer infermeta 需要走 AST 动转静,并在结束后 rollback 回原来的函数,rollback 时候用的是 dygraph_function.__name__

但是在 PaddleNLP 中,部分函数是被 patch 的,dygraph_function.__name__ 和实际 patch 的名字不一样,比如 paddle.nn.TransformerEncoderLayer.forward = _transformer_encoder_layer_fwddygraph_function.__name___transformer_encoder_layer_fwd,因此最后恢复没有恢复到 forward,导致后续 forward 仍然是转静后的函数

因此在 patch 时记录到底 patch 到哪个 name 上,以确保最终能正确恢复

https://github.com/PaddlePaddle/PaddleNLP/blob/a5ec6bf623ce8e68ce84e0620d1e195072b25643/paddlenlp/transformers/model_outputs.py#L362-L365

#69936,但只是临时解决方案,因为 #69936 有一些坑还不太好解决

PCard-66972

Copy link

paddle-bot bot commented Dec 4, 2024

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

@SigureMo SigureMo merged commit 173d018 into PaddlePaddle:develop Dec 4, 2024
28 checks passed
@SigureMo SigureMo deleted the dy2st/record-patched-name-to-avoid-rollback-failures2 branch December 4, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants