-
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
hapi supports pir #68344
Merged
Merged
hapi supports pir #68344
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zbt78
requested review from
XiaoguangHu01,
zhiqiu,
Xreki,
qili93 and
Aurelius84
as code owners
September 20, 2024 09:29
wanghuancoder
approved these changes
Sep 27, 2024
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
XiaoguangHu01
approved these changes
Sep 27, 2024
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
XieYunshen
approved these changes
Sep 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
New features
Description
hapi 适配 pir
在hapi中,需要首先构造一个network,然后作为参数传入Model类中,用来训练,推理等等。同时network里面的参数是在传入hapi的Model之前就已经创建好的。hapi的内部需要保存三个program,分别是train,test,eval,都是由default_main_program clone而来。而目前pir program的clone机制对parameter的clone有个问题,表现为:pir的program在clone之后,paramter在新的program中确确实实会clone一份,但新program的op中使用到的parameter operand仍旧是旧program中的,这样执行器执行的时候会出问题。目前通过给network的parameter重新赋值为新program clone出来的parameter,然后再构造program的方式解决了这个问题。
具体表现为:
输出:
打印结果中的长串数字为program的id,可以看到
pd_op.add
的第二个操作数是原始program中的参数。下面是对新增接口的一些解释:
GetAllParameterValues
:获取当前program的所有parameter。set_is_test_attr
:有一些算子在训练和推理的模式下表现不一致,需要用is_test属性区别,此接口用来修改训练模式下op的is_test属性。