-
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
create learning rate variable for every parameter #5524
Conversation
shape=param_lr_shape, | ||
lod_level=1, | ||
persistable=True) | ||
param_lr = param_lr * self._learning_rate |
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.
Are we sure that this will be multiplied? Is there a reference for this implementation or is it taken from the old Paddle code?
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 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 way old PaddlePaddle uses. The learning rate of one parameter is determined by multiplying the global learning rate to the layerwise set learning rate (if set).
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.
@lcy-seso Do you know how this works together with learning rate scheduler? Does the learning rate scheduler only work for the global learning rate?
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.
From the codes, it seems that the learning rate schedule only works for global learning rate:
In old PaddlePaddle it seems that the learning rate scheduler just calculates a scale factor to decrease the learning rate.
calcLearningRate
adjusts the learning rate:
https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/parameter/FirstOrderOptimizer.h#L32 https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/parameter/ParameterOptimizer.h#L49- Here takes Adam for example, how the final learning rate in
update
calculates:
https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/parameter/FirstOrderOptimizer.cpp#L272
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!
Fix #5525