提交 d6530df5 编写于 作者: J Joejiong

change clip1 to clip

上级 39adc740
......@@ -137,7 +137,7 @@ def main():
res_vars = res_vars[:-1]
loss, last_hidden, last_cell, feed_order = res_vars
clip1 = fluid.clip.GradientClipByGlobalNorm(
clip = fluid.clip.GradientClipByGlobalNorm(
clip_norm=config.max_grad_norm)
learning_rate = fluid.layers.create_global_var(
......@@ -148,7 +148,7 @@ def main():
persistable=True)
optimizer = fluid.optimizer.SGD(learning_rate=learning_rate,
grad_clip=clip1)
grad_clip=clip)
optimizer.minimize(loss)
# define inference program
......
......@@ -102,10 +102,9 @@ def optimization(loss,
raise ValueError("Unkown learning rate scheduler, should be "
"'noam_decay' or 'linear_warmup_decay'")
clip1 = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0)
clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0)
optimizer = fluid.optimizer.Adam(
learning_rate=scheduled_lr, grad_clip=clip1)
optimizer = fluid.optimizer.Adam(learning_rate=scheduled_lr, grad_clip=clip)
def exclude_from_weight_decay(param):
name = param.name.rstrip(".master")
......
......@@ -110,10 +110,9 @@ def optimization(loss,
return True
return False
clip1 = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0)
clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0)
optimizer = fluid.optimizer.Adam(
learning_rate=scheduled_lr, grad_clip=clip1)
optimizer = fluid.optimizer.Adam(learning_rate=scheduled_lr, grad_clip=clip)
param_list = dict()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册