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
801aaa55
"sgl-router/tests/vscode:/vscode.git/clone" did not exist on "dae9a80f43e8dce2b27f93134fa78909a9a9feef"
Commit
801aaa55
authored
Jan 17, 2020
by
Julien Chaumond
Browse files
make style
parent
56d4ba8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
examples/run_lm_finetuning.py
examples/run_lm_finetuning.py
+5
-5
No files found.
examples/run_lm_finetuning.py
View file @
801aaa55
...
...
@@ -228,8 +228,10 @@ def train(args, train_dataset, model: PreTrainedModel, tokenizer: PreTrainedToke
)
# Check if saved optimizer or scheduler states exist
if
args
.
model_name_or_path
and
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
model_name_or_path
,
"optimizer.pt"
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
model_name_or_path
,
"scheduler.pt"
)
if
(
args
.
model_name_or_path
and
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
model_name_or_path
,
"optimizer.pt"
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
model_name_or_path
,
"scheduler.pt"
))
):
# Load in optimizer and scheduler states
optimizer
.
load_state_dict
(
torch
.
load
(
os
.
path
.
join
(
args
.
model_name_or_path
,
"optimizer.pt"
)))
...
...
@@ -587,9 +589,7 @@ def main():
if
args
.
should_continue
:
sorted_checkpoints
=
_sorted_checkpoints
(
args
)
if
len
(
sorted_checkpoints
)
==
0
:
raise
ValueError
(
"Used --should_continue but no checkpoint was found in --output_dir."
)
raise
ValueError
(
"Used --should_continue but no checkpoint was found in --output_dir."
)
else
:
args
.
model_name_or_path
=
sorted_checkpoints
[
-
1
]
...
...
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