-
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
Simplify fluid api for fit a line #10301
Simplify fluid api for fit a line #10301
Conversation
return | ||
|
||
place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace() | ||
exe = fluid.Executor(place) |
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.
I think the purpose of this API Simplification effort is to hide details like Executor.
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.
Yes. The infer
is in old format for a reason. #10426
I will change it to new API once it is implemented. The current PR only changed trainer.train()
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.
@daming-lu : You could take a look at Jeff's PR: https://github.com/PaddlePaddle/Paddle/pull/10308/files#diff-07faf3656ed1409403fcb2bb7e00f455R93
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.
@sidgoyal78 Thanks Sid. I kept the old infer() on purpose. I want the test to be OK with new trainer.train and old infer.
@daming-lu Please take a look at #10248 for your reference. Thanks! |
return avg_loss | ||
|
||
|
||
def train(use_cuda, save_dirname, is_local): |
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.
is_local
is unused. What is it?
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.
Yes. Removed. Also triggered TeamCity
# NOT clear yet | ||
# fluid.io.save_inference_model(save_dirname, ['x'], [y_predict]) | ||
# trainer.save_params(save_dirname) | ||
trainer.save_inference_model(save_dirname) |
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.
This is the correct way to save model now. See here
@tonyyang-svail Thanks to YangYang for the bug fix. It was a tricky one 😭 |
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. Thanks, @daming-lu , this would be a good start to migrate to the new API.
modified
test_fit_a_line.py
to follow the new pattern here