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
adb8c931
Commit
adb8c931
authored
Jan 28, 2020
by
Jared Nielsen
Committed by
Lysandre Debut
Jan 29, 2020
Browse files
Remove lines causing a KeyError
parent
c69b0826
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
3 deletions
+0
-3
examples/run_tf_glue.py
examples/run_tf_glue.py
+0
-3
No files found.
examples/run_tf_glue.py
View file @
adb8c931
...
@@ -99,9 +99,6 @@ if TASK == "mrpc":
...
@@ -99,9 +99,6 @@ if TASK == "mrpc":
inputs_1
=
tokenizer
.
encode_plus
(
sentence_0
,
sentence_1
,
add_special_tokens
=
True
,
return_tensors
=
"pt"
)
inputs_1
=
tokenizer
.
encode_plus
(
sentence_0
,
sentence_1
,
add_special_tokens
=
True
,
return_tensors
=
"pt"
)
inputs_2
=
tokenizer
.
encode_plus
(
sentence_0
,
sentence_2
,
add_special_tokens
=
True
,
return_tensors
=
"pt"
)
inputs_2
=
tokenizer
.
encode_plus
(
sentence_0
,
sentence_2
,
add_special_tokens
=
True
,
return_tensors
=
"pt"
)
del
inputs_1
[
"special_tokens_mask"
]
del
inputs_2
[
"special_tokens_mask"
]
pred_1
=
pytorch_model
(
**
inputs_1
)[
0
].
argmax
().
item
()
pred_1
=
pytorch_model
(
**
inputs_1
)[
0
].
argmax
().
item
()
pred_2
=
pytorch_model
(
**
inputs_2
)[
0
].
argmax
().
item
()
pred_2
=
pytorch_model
(
**
inputs_2
)[
0
].
argmax
().
item
()
print
(
"sentence_1 is"
,
"a paraphrase"
if
pred_1
else
"not a paraphrase"
,
"of sentence_0"
)
print
(
"sentence_1 is"
,
"a paraphrase"
if
pred_1
else
"not a paraphrase"
,
"of sentence_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