-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Paddle API v4 proposal #10152
Comments
this looks good. one question, when is the reader initialized? when the first iteration is ran? we probably need to implicitly do this, maybe by creating a static or shared reader? |
Is the assumption here that we can return a tuple if we want to capture multiple variables during the training steps? For example, we should be able to do |
How about: fit_a_line.py...
def train_step(batch_size):
...
return self.program({ 'avg_cost': avg_cost })
... main.pyfrom fit_a_line import FitALine
trainer = FitALine().train_step(batch_size=256)
while i in range(1000):
cost = trainer()['avg_cost']
y_results = FitALine().infer([3,4,6,3,5,7,8,6,5,4,1,5,8]) |
Thanks for this design @cs2be and @helinwang ! I have a few questions:
|
Hi @wangkuiyi,
|
Thanks for reviewing @wangkuiyi ! @cs2be and me discussed, here are the replies:
Many thanks to @cs2be for coming out this idea. I think the power of this idea comes from it enables the state to be shared cross many methods: program = FitALine().Compile()
# program.train knows the block ID,
# so program desc does not have to store function name.
program.train()
program.infer() In the above code, The user could come up with many things that they want to do:
Yes, that is correct.
Great point, @cs2be and I have discussed and updated the example. The block input will be a var, created by
Summary: Pytorch uses Python to call each operator, this API uses Python to call each compiled function. |
I think this proposal looks mostly good! One question: > TRAINING_ROLE=TRAINER python main.py --distributed main=train_step How does the Compile() logic magically knows how to transpile a program into In more detail, how does the transpiler know which operators and variables should |
@panyx0718 thanks for the review!
Our current transpiler implementation does "magically" make everything work. Indeed, it is hacky because a lot of assumptions has been made. To improve, the transpiler needs to know more information, such as "which operators belongs to the optimizers", "which operators belong to the gradient calculating pass", "which operators are explicitly defined by the user". I think we should store these information in the program desc. Do you think the API makes sense, regardless of the current transpiler implementation (or assuming we have implemented it in the non-hacky way)? |
Can we change |
I think the skeleton looks fine.
There can be several configuration options for "distributed" training |
Other Paddle team members can take a look at this proposal. |
Can @network() support training multiple networks, like GAN? |
@jacquesqiao thanks for reviewing! Yes I think so. Multiple class methods annotated by |
您好,此issue在近一个月内暂无更新,我们将于今天内关闭。若在关闭后您仍需跟进提问,可重新开启此问题,我们将在24小时内回复您。因关闭带来的不便我们深表歉意,请您谅解~感谢您对PaddlePaddle的支持! |
Pytorch uses Python to call each operator, the following API uses Python to call each compiled function.
fit_a_line.py
main.py
Transpiler
Trainer
PServer
The text was updated successfully, but these errors were encountered: