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
070f3b21
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "11163fff587810d6feec9c3b1d7013fb8a8777a0"
Commit
070f3b21
authored
Feb 27, 2019
by
lukovnikov
Browse files
added warning
parent
46ef6460
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
pytorch_pretrained_bert/optimization.py
pytorch_pretrained_bert/optimization.py
+4
-4
pytorch_pretrained_bert/optimization_openai.py
pytorch_pretrained_bert/optimization_openai.py
+4
-4
No files found.
pytorch_pretrained_bert/optimization.py
View file @
070f3b21
...
...
@@ -154,15 +154,15 @@ class BertAdam(Optimizer):
if
group
[
't_total'
]
!=
-
1
:
schedule_fct
=
SCHEDULES
[
group
[
'schedule'
]]
# warning for exceeding t_total (only active with warmup_linear
progress
=
state
[
'step'
]
/
group
[
't_total'
]
lr_scheduled
=
group
[
'lr'
]
*
schedule_fct
(
progress
,
group
[
'warmup'
])
# warning for exceeding t_total (only active with warmup_linear
if
progress
>
1.
and
progress
>
self
.
_warned_for_t_total_at_progress
:
logger
.
warning
(
"Training beyond specified 't_total' steps. Learning rate set to
zero
. "
"Please set 't_total' of {} correctly."
.
format
(
self
.
__class__
.
__name__
))
"Training beyond specified 't_total' steps. Learning rate set to
{}
. "
"Please set 't_total' of {} correctly."
.
format
(
lr_scheduled
,
self
.
__class__
.
__name__
))
self
.
_warned_for_t_total_at_progress
=
progress
# end warning
lr_scheduled
=
group
[
'lr'
]
*
schedule_fct
(
progress
,
group
[
'warmup'
])
else
:
lr_scheduled
=
group
[
'lr'
]
...
...
pytorch_pretrained_bert/optimization_openai.py
View file @
070f3b21
...
...
@@ -137,15 +137,15 @@ class OpenAIAdam(Optimizer):
if
group
[
't_total'
]
!=
-
1
:
schedule_fct
=
SCHEDULES
[
group
[
'schedule'
]]
# warning for exceeding t_total (only active with warmup_linear
progress
=
state
[
'step'
]
/
group
[
't_total'
]
lr_scheduled
=
group
[
'lr'
]
*
schedule_fct
(
progress
,
group
[
'warmup'
])
# warning for exceeding t_total (only active with warmup_linear
if
progress
>
1.
and
progress
>
self
.
_warned_for_t_total_at_progress
:
logger
.
warning
(
"Training beyond specified 't_total' steps. Learning rate set to
zero
. "
"Please set 't_total' of {} correctly."
.
format
(
self
.
__class__
.
__name__
))
"Training beyond specified 't_total' steps. Learning rate set to
{}
. "
"Please set 't_total' of {} correctly."
.
format
(
lr_scheduled
,
self
.
__class__
.
__name__
))
self
.
_warned_for_t_total_at_progress
=
progress
# end warning
lr_scheduled
=
group
[
'lr'
]
*
schedule_fct
(
progress
,
group
[
'warmup'
])
else
:
lr_scheduled
=
group
[
'lr'
]
...
...
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