-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Get rid of pickle for fluid inference #7339
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
| message ProgramDesc { repeated BlockDesc blocks = 1; } | ||
| message ProgramDesc { | ||
| repeated BlockDesc blocks = 1; | ||
| repeated string feed_var_names = 2; |
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.
Why do we need to add feed_var_names and fetch_var_names here? The current ProgramDesc, which supports training, should be able to read training data — maybe from some data feeding operators I vaguely remember? If so, it seems that we can reuse these feeding operators, or invent some new operators for data feeding specifically at inference time?
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.
BTW, given the fact that we are moving to use a WhileOp to represent the iteration loop at training time, I don’t expect a ProgramDesc that describes a training program can be shared and reused without any modification at inference time. As we’d need a new ProgramDesc specifically for inference, we can have inference data feeding operators in this new ProgramDesc.
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.
@wangkuiyi This is the approach we have been discussing too here: #7328 . Defining a ProgramDesc for Inference separately that has all Inference specific requirements addressed separately, and that can reuse our already existing ProgramDesc.
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.
Thanks @wangkuiyi for the clarification on ProgramDesc. We are exploring different paths of obtaining a Desc for inference and discussing which one to use. Based on your comment, I think we will follow things the proposal in #7328. @abhinavarora is working on a PR based on that.
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.
There is no feed_op or fetch_op in current train and inference ProgramDesc. Each time we run a train ProgramDesc, the Executor will clone a copy of the train ProgramDesc and insert feed_ops and fetch_ops to the copy of the train ProgramDesc.
@wangkuiyi do you mean to insert feed_op and fetch_op to inference ProgramDesc when saving? It is a way to solve this problem.
There is a proposal of mine, with no need to modify the current ProgramDesc or define another ProgramDesc, but I am not sure if it works. @kexinzhao @abhinavarora @kavyasrinet
- We can traverse all the non-persistable variables in the inference
ProgramDesc. If the variable is not an output of any operators, we think it is a feed variable. If the variable is not an input of any operators, we think it is a fetch variable.
Update:
I find a disadvantage of my proposal. User may specify the output of some middle operator (some operator in the middle position of the network and has output) to the fetch list.
fixes #7221
Put fetch_var_names and feed_var_names as repeated string fields in the ProgramDesc
To test this PR:
After these steps, you can run the example using:
The output is similar to #7097