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
374deef4
Commit
374deef4
authored
Mar 09, 2020
by
Patrick von Platen
Browse files
fixed typo
parent
a2c8e516
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
tests/test_modeling_bart.py
tests/test_modeling_bart.py
+1
-1
No files found.
src/transformers/modeling_utils.py
View file @
374deef4
...
...
@@ -855,7 +855,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
cur_len
=
1
# put model in generation mode if it has one
if
hasattr
(
self
.
model
,
"generation_mode"
):
if
hasattr
(
self
.
model
,
"decoder"
)
and
hasattr
(
self
.
model
.
decoder
,
"generation_mode"
):
self
.
model
.
decoder
.
generation_mode
=
True
else
:
encoder_inputs
=
None
...
...
tests/test_modeling_bart.py
View file @
374deef4
...
...
@@ -287,7 +287,7 @@ class BartHeadTests(unittest.TestCase):
new_input_ids
=
lm_model
.
generate
(
input_ids
.
clone
(),
num_return_sequences
=
1
,
num_beams
=
2
,
no_repeat_ngram_size
=
3
,
max_length
=
max_length
)
self
.
assertEqual
(
new_input_ids
.
shape
,
(
input_ids
.
shape
[
0
],
max_length
-
1
))
self
.
assertEqual
(
new_input_ids
.
shape
,
(
input_ids
.
shape
[
0
],
max_length
))
# TODO(SS): uneven length batches, empty inputs
def
test_shift_tokens_right
(
self
):
...
...
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