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
2e8c5c00
Unverified
Commit
2e8c5c00
authored
Jan 07, 2019
by
Thomas Wolf
Committed by
GitHub
Jan 07, 2019
Browse files
Merge pull request #141 from SinghJasdeep/patch-1
loading saved model when n_classes != 2
parents
28603770
99709ee6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/run_classifier.py
examples/run_classifier.py
+1
-1
No files found.
examples/run_classifier.py
View file @
2e8c5c00
...
...
@@ -558,7 +558,7 @@ def main():
# Load a trained model that you have fine-tuned
model_state_dict
=
torch
.
load
(
output_model_file
)
model
=
BertForSequenceClassification
.
from_pretrained
(
args
.
bert_model
,
state_dict
=
model_state_dict
)
model
=
BertForSequenceClassification
.
from_pretrained
(
args
.
bert_model
,
state_dict
=
model_state_dict
,
num_labels
=
num_labels
)
model
.
to
(
device
)
if
args
.
do_eval
and
(
args
.
local_rank
==
-
1
or
torch
.
distributed
.
get_rank
()
==
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