"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "fbd879219584e4a3b438d41306d68a6d85ce3da8"
Commit d164867d authored by lukovnikov's avatar lukovnikov
Browse files

- updated docs for optimization

parent 1758c8fc
...@@ -20,7 +20,8 @@ import unittest ...@@ -20,7 +20,8 @@ import unittest
import torch import torch
from pytorch_pretrained_bert import BertAdam, WarmupCosineWithRestartsSchedule from pytorch_pretrained_bert import BertAdam
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
...@@ -50,7 +51,7 @@ class OptimizationTest(unittest.TestCase): ...@@ -50,7 +51,7 @@ class OptimizationTest(unittest.TestCase):
class WarmupCosineWithRestartsTest(unittest.TestCase): class WarmupCosineWithRestartsTest(unittest.TestCase):
def test_it(self): def test_it(self):
m = WarmupCosineWithRestartsSchedule(warmup=0.2, t_total=1, cycles=3) m = WarmupCosineWithWarmupRestartsSchedule(warmup=0.05, t_total=1, cycles=3)
x = np.arange(0, 1000) / 1000 x = np.arange(0, 1000) / 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)
......
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