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
c5441946
Unverified
Commit
c5441946
authored
Oct 16, 2019
by
Lysandre Debut
Committed by
GitHub
Oct 16, 2019
Browse files
Remove `special_tokens_mask` from inputs in README
Co-authored-by: Thomas Wolf @thomwolf
parent
be916cb3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
README.md
README.md
+3
-2
No files found.
README.md
View file @
c5441946
...
...
@@ -243,8 +243,9 @@ sentence_2 = "His findings were not compatible with this research."
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'
)
pred_1
=
pytorch_model
(
**
inputs_1
)[
0
].
argmax
().
item
()
pred_2
=
pytorch_model
(
**
inputs_2
)[
0
].
argmax
().
item
()
pred_1
=
pytorch_model
(
inputs_1
[
'input_ids'
],
token_type_ids
=
inputs_1
[
'token_type_ids'
])[
0
].
argmax
().
item
()
pred_2
=
pytorch_model
(
inputs_2
[
'input_ids'
],
token_type_ids
=
inputs_2
[
'token_type_ids'
])[
0
].
argmax
().
item
()
print
(
"sentence_1 is"
,
"a paraphrase"
if
pred_1
else
"not a paraphrase"
,
"of sentence_0"
)
print
(
"sentence_2 is"
,
"a paraphrase"
if
pred_2
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