Commit 1b4ce76c authored by lukovnikov's avatar lukovnikov
Browse files

schedule fix

parent 5fed5bb3
...@@ -22,7 +22,7 @@ import torch ...@@ -22,7 +22,7 @@ import torch
from pytorch_pretrained_bert import BertAdam from pytorch_pretrained_bert import BertAdam
from pytorch_pretrained_bert.optimization import WarmupCosineWithWarmupRestartsSchedule from pytorch_pretrained_bert.optimization import WarmupCosineWithWarmupRestartsSchedule
from matplotlib import pyplot as plt #from matplotlib import pyplot as plt
import numpy as np import numpy as np
class OptimizationTest(unittest.TestCase): class OptimizationTest(unittest.TestCase):
...@@ -54,8 +54,8 @@ class WarmupCosineWithRestartsTest(unittest.TestCase): ...@@ -54,8 +54,8 @@ class WarmupCosineWithRestartsTest(unittest.TestCase):
m = WarmupCosineWithWarmupRestartsSchedule(warmup=0.05, t_total=1000, cycles=5) m = WarmupCosineWithWarmupRestartsSchedule(warmup=0.05, t_total=1000, cycles=5)
x = np.arange(0, 1000) x = np.arange(0, 1000)
y = [m.get_lr(xe) for xe in x] y = [m.get_lr(xe) for xe in x]
plt.plot(y) # plt.plot(y)
plt.show(block=False) # plt.show(block=False)
y = np.asarray(y) y = np.asarray(y)
expected_zeros = y[[0, 200, 400, 600, 800]] expected_zeros = y[[0, 200, 400, 600, 800]]
print(expected_zeros) print(expected_zeros)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment