This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fit a line : 2nd fix #525
Merged
daming-lu
merged 5 commits into
PaddlePaddle:high-level-api-branch
from
daming-lu:fit_a_line_2nd_fix
Jun 1, 2018
Merged
Fit a line : 2nd fix #525
daming-lu
merged 5 commits into
PaddlePaddle:high-level-api-branch
from
daming-lu:fit_a_line_2nd_fix
Jun 1, 2018
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
daming-lu
commented
May 31, 2018
step = 0 | ||
|
||
# event_handler to print training and testing info | ||
def event_handler(event): | ||
def event_handler_plot(event): | ||
global step |
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.
Here we still need a global step because event.step
only goes 0-20 in one EndStepEvent. We need the step to keep growing. Otherwise the plot would look weird like zig-zag.
@@ -212,14 +210,9 @@ def event_handler(event): | |||
print('loss is less than 10.0, stop') | |||
trainer.stop() | |||
|
|||
if step >= 2000: |
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.
# We can save the trained parameters for the inferences later | ||
if params_folder is not None: | ||
trainer.save_params(params_folder) | ||
if params_dirname is not None: |
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.
changed name
@@ -233,7 +226,7 @@ def event_handler(event): | |||
trainer.train( | |||
reader=train_reader, | |||
num_epochs=100, | |||
event_handler=event_handler, | |||
event_handler=event_handler_plot, |
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.
changed name
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.