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
38a1b03f
Unverified
Commit
38a1b03f
authored
Sep 25, 2020
by
Sam Shleifer
Committed by
GitHub
Sep 25, 2020
Browse files
Remove unhelpful bart warning (#7391)
parent
5ff0d6d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
6 deletions
+1
-6
src/transformers/modeling_bart.py
src/transformers/modeling_bart.py
+1
-6
No files found.
src/transformers/modeling_bart.py
View file @
38a1b03f
...
@@ -550,13 +550,8 @@ class BartDecoder(nn.Module):
...
@@ -550,13 +550,8 @@ class BartDecoder(nn.Module):
positions
=
self
.
embed_positions
(
input_ids
,
use_cache
=
use_cache
)
positions
=
self
.
embed_positions
(
input_ids
,
use_cache
=
use_cache
)
if
use_cache
:
if
use_cache
:
if
input_ids
.
shape
[
1
]
!=
1
or
past_key_values
is
None
:
# if you make this an AssertionError, test_benchmark breaks.
warnings
.
warn
(
"pass decoder_past_key_value_states to use_cache"
)
input_ids
=
input_ids
[:,
-
1
:]
input_ids
=
input_ids
[:,
-
1
:]
positions
=
positions
[:,
-
1
:]
# happens after we embed them
positions
=
positions
[:,
-
1
:]
# assert input_ids.ne(self.padding_idx).any()
x
=
self
.
embed_tokens
(
input_ids
)
*
self
.
embed_scale
x
=
self
.
embed_tokens
(
input_ids
)
*
self
.
embed_scale
x
+=
positions
x
+=
positions
...
...
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