Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
1b4ce76c
Commit
1b4ce76c
authored
Apr 03, 2019
by
lukovnikov
Browse files
schedule fix
parent
5fed5bb3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/optimization_test.py
tests/optimization_test.py
+3
-3
No files found.
tests/optimization_test.py
View file @
1b4ce76c
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment