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
1db916b5
Commit
1db916b5
authored
Dec 09, 2018
by
thomwolf
Browse files
compatibility PT 1.0 and 0.4.1
parent
68f77303
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
tests/optimization_test.py
tests/optimization_test.py
+1
-1
No files found.
tests/optimization_test.py
View file @
1db916b5
...
@@ -32,7 +32,7 @@ class OptimizationTest(unittest.TestCase):
...
@@ -32,7 +32,7 @@ class OptimizationTest(unittest.TestCase):
def
test_adam
(
self
):
def
test_adam
(
self
):
w
=
torch
.
tensor
([
0.1
,
-
0.2
,
-
0.1
],
requires_grad
=
True
)
w
=
torch
.
tensor
([
0.1
,
-
0.2
,
-
0.1
],
requires_grad
=
True
)
target
=
torch
.
tensor
([
0.4
,
0.2
,
-
0.5
])
target
=
torch
.
tensor
([
0.4
,
0.2
,
-
0.5
])
criterion
=
torch
.
nn
.
MSELoss
(
reduction
=
'elementwise_mean'
)
criterion
=
torch
.
nn
.
MSELoss
()
# No warmup, constant schedule, no gradient clipping
# No warmup, constant schedule, no gradient clipping
optimizer
=
BertAdam
(
params
=
[
w
],
lr
=
2e-1
,
optimizer
=
BertAdam
(
params
=
[
w
],
lr
=
2e-1
,
weight_decay_rate
=
0.0
,
weight_decay_rate
=
0.0
,
...
...
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