File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -228,7 +228,6 @@ def save(obj, path):
228228 emb = paddle.nn.Embedding(10, 10)
229229 layer_state_dict = emb.state_dict()
230230 paddle.save(layer_state_dict, "emb.pdparams")
231-
232231 scheduler = paddle.optimizer.lr.NoamDecay(
233232 d_model=0.01, warmup_steps=100, verbose=True)
234233 adam = paddle.optimizer.Adam(
@@ -320,7 +319,6 @@ def load(path, **configs):
320319 emb = paddle.nn.Embedding(10, 10)
321320 layer_state_dict = emb.state_dict()
322321 paddle.save(layer_state_dict, "emb.pdparams")
323-
324322 scheduler = paddle.optimizer.lr.NoamDecay(
325323 d_model=0.01, warmup_steps=100, verbose=True)
326324 adam = paddle.optimizer.Adam(
Original file line number Diff line number Diff line change @@ -1434,7 +1434,8 @@ class CosineAnnealingDecay(LRScheduler):
14341434 loss.backward()
14351435 sgd.step()
14361436 sgd.clear_gradients()
1437- scheduler.step()
1437+ scheduler.step() # If you update learning rate each step
1438+ # scheduler.step() # If you update learning rate each epoch
14381439
14391440 # train on static graph mode
14401441 paddle.enable_static()
@@ -1460,7 +1461,8 @@ class CosineAnnealingDecay(LRScheduler):
14601461 'y': np.random.randn(3, 4, 5).astype('float32')
14611462 },
14621463 fetch_list=loss.name)
1463- scheduler.step()
1464+ scheduler.step() # If you update learning rate each step
1465+ # scheduler.step() # If you update learning rate each epoch
14641466 """
14651467
14661468 def __init__ (self ,
You can’t perform that action at this time.
0 commit comments