-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[GLCC]Part-3: Support jit.save and jit.load for pylayer op #57066
[GLCC]Part-3: Support jit.save and jit.load for pylayer op #57066
Conversation
e2983c3
to
d049e0e
Compare
for backward program
in jit.load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,一些代码规范上小的 Comment 可以单独提PR fix
def forward(self, x1, x2): | ||
y1 = self.linear1(x1) | ||
y2 = self.linear1(x2) | ||
out = cus_tanh_2.apply(y1, func1=paddle.tanh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out = cus_tanh_2.apply(y1, func1=paddle.tanh) | |
out = cus_tanh_2.apply(y1, paddle.tanh) |
部分单测可以去掉形参指示,这样可以丰富单测样例
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,将在下一个 pr 进行修改
@@ -160,77 +211,83 @@ def _mock_guard(mock): | |||
base.Executor._prune_program = original | |||
|
|||
|
|||
def net1(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def net1(): | |
def create_net1(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,将在下一个 pr 进行修改
return x, y, label, loss1, loss2, w_param_attrs | ||
|
||
|
||
def net2(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def net2(): | |
def create_net2(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,将在下一个 pr 进行修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…dle#57066) * complete static_pylayer op * finish static_pylayer op context manager * finish single test * append import path * maybe modify test/ir/inference * percept static_pylayer op in dy2st
…dle#57066) * complete static_pylayer op * finish static_pylayer op context manager * finish single test * append import path * maybe modify test/ir/inference * percept static_pylayer op in dy2st
…dle#57066) * complete static_pylayer op * finish static_pylayer op context manager * finish single test * append import path * maybe modify test/ir/inference * percept static_pylayer op in dy2st
PR types
New features
PR changes
Others
Description
Original requirements
It is expected that the PyLayer mechanism in the dynamic graph of the Paddle can interoperate with the @to_staitc of the Paddle's dynamic to static, supporting the custom layer of the PyLayer in the model to be perceived by the @to_static and correctly generating the static graph Program, and supporting the training of the dynamic to static and the exporting for inference.
So our main objective is to Enable PyLayer to Support @to_static. In this PR, we support
pylayer
op can be exported byjit.save
and loaded byjit.load
for subsequent inference.Related issues
【Feature Request】 PyLayer 功能支持动转静 @to_static 🚀: #54120
Related PR
[GLCC]Part-1: Add pylayer op to Support @to_static: #56108
[GLCC]Part-2: @to_static support for PyLayer: #56531
Project Records
https://github.com/MarioLulab/GLCC2023-Paddle-Record
Main works
core.prune
andcore.prune_backward
to handleBLOCKS
attribute of operators by refining theprune.cc
.normalize_program
function to remove backward block id ofpylayer
op.test_prune.py
,test_program_prune_backward.py
andtest_inference_model_io.py
, etc.PyLayer
.