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
225de5cc
Unverified
Commit
225de5cc
authored
Aug 25, 2021
by
Nishant Prabhu
Committed by
GitHub
Aug 25, 2021
Browse files
Replace assert statement with if condition and ValueError (#13263)
parent
46554fc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/optimization.py
src/transformers/optimization.py
+2
-1
No files found.
src/transformers/optimization.py
View file @
225de5cc
...
...
@@ -201,7 +201,8 @@ def get_polynomial_decay_schedule_with_warmup(
"""
lr_init
=
optimizer
.
defaults
[
"lr"
]
assert
lr_init
>
lr_end
,
f
"lr_end (
{
lr_end
}
) must be be smaller than initial lr (
{
lr_init
}
)"
if
not
(
lr_init
>
lr_end
):
raise
ValueError
(
f
"lr_end (
{
lr_end
}
) must be be smaller than initial lr (
{
lr_init
}
)"
)
def
lr_lambda
(
current_step
:
int
):
if
current_step
<
num_warmup_steps
:
...
...
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