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
625318f5
Unverified
Commit
625318f5
authored
Aug 25, 2020
by
Funtowicz Morgan
Committed by
GitHub
Aug 25, 2020
Browse files
tensor.nonzero() is deprecated in PyTorch 1.6 (#6715)
Signed-off-by:
Morgan Funtowicz
<
funtowiczmo@gmail.com
>
parent
124c3d6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/pipelines.py
src/transformers/pipelines.py
+1
-1
No files found.
src/transformers/pipelines.py
View file @
625318f5
...
@@ -1226,7 +1226,7 @@ class FillMaskPipeline(Pipeline):
...
@@ -1226,7 +1226,7 @@ class FillMaskPipeline(Pipeline):
values
=
tf
.
gather_nd
(
values
,
tf
.
reshape
(
sort_inds
,
(
-
1
,
1
))).
numpy
()
values
=
tf
.
gather_nd
(
values
,
tf
.
reshape
(
sort_inds
,
(
-
1
,
1
))).
numpy
()
predictions
=
target_inds
[
sort_inds
.
numpy
()]
predictions
=
target_inds
[
sort_inds
.
numpy
()]
else
:
else
:
masked_index
=
(
input_ids
==
self
.
tokenizer
.
mask_token_id
).
nonzero
(
)
masked_index
=
torch
.
nonzero
(
input_ids
==
self
.
tokenizer
.
mask_token_id
,
as_tuple
=
False
)
# Fill mask pipeline supports only one ${mask_token} per sample
# Fill mask pipeline supports only one ${mask_token} per sample
self
.
ensure_exactly_one_mask_token
(
masked_index
.
numpy
())
self
.
ensure_exactly_one_mask_token
(
masked_index
.
numpy
())
...
...
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