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
a5bd40b7
Unverified
Commit
a5bd40b7
authored
Mar 04, 2021
by
Sylvain Gugger
Committed by
GitHub
Mar 04, 2021
Browse files
Not always consider a local model a checkpoint in run_glue (#10517)
parent
745ea78d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
examples/text-classification/run_glue.py
examples/text-classification/run_glue.py
+6
-3
No files found.
examples/text-classification/run_glue.py
View file @
a5bd40b7
...
@@ -406,12 +406,15 @@ def main():
...
@@ -406,12 +406,15 @@ def main():
# Training
# Training
if
training_args
.
do_train
:
if
training_args
.
do_train
:
checkpoint
=
None
if
last_checkpoint
is
not
None
:
if
last_checkpoint
is
not
None
:
checkpoint
=
last_checkpoint
checkpoint
=
last_checkpoint
elif
os
.
path
.
isdir
(
model_args
.
model_name_or_path
):
elif
os
.
path
.
isdir
(
model_args
.
model_name_or_path
):
checkpoint
=
model_args
.
model_name_or_path
# Check the config from that potential checkpoint has the right number of labels before using it as a
else
:
# checkpoint.
checkpoint
=
None
if
AutoConfig
.
from_pretrained
(
model_args
.
model_name_or_path
).
num_labels
==
num_labels
:
checkpoint
=
model_args
.
model_name_or_path
train_result
=
trainer
.
train
(
resume_from_checkpoint
=
checkpoint
)
train_result
=
trainer
.
train
(
resume_from_checkpoint
=
checkpoint
)
metrics
=
train_result
.
metrics
metrics
=
train_result
.
metrics
...
...
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