提交 15ae5176 编写于 作者: T tink2123

add cosine decay

上级 ae2589b4
......@@ -41,3 +41,7 @@ Optimizer:
base_lr: 0.0005
beta1: 0.9
beta2: 0.999
decay:
function: cosine_decay
step_each_epoch: 20
total_epoch: 1000
......@@ -28,6 +28,16 @@ def AdamDecay(params, parameter_list=None):
base_lr = params['base_lr']
beta1 = params['beta1']
beta2 = params['beta2']
if 'decay' in params:
params = params['decay']
decay_mode = params['function']
step_each_epoch = params['step_each_epoch']
total_epoch = params['total_epoch']
if decay_mode == "cosine_decay":
base_lr = fluid.layers.cosine_decay(
learning_rate=base_lr,
step_each_epoch=step_each_epoch,
epochs=total_epoch)
optimizer = fluid.optimizer.Adam(
learning_rate=base_lr,
beta1=beta1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册