Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
d039c679
Commit
d039c679
authored
Dec 23, 2019
by
patrickvonplaten
Browse files
better naming for if statement
parent
7e0c5c73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+5
-1
No files found.
src/transformers/modeling_utils.py
View file @
d039c679
...
...
@@ -542,7 +542,11 @@ class PreTrainedModel(nn.Module):
def
_do_output_past
(
self
,
outputs
):
# TODO: might be better to write a self.do_output_past method for each individual class as is done for
# prepare_inputs_for_generation
if
hasattr
(
self
.
config
,
'output_past'
)
and
self
.
config
.
output_past
and
len
(
outputs
)
>
1
and
not
hasattr
(
self
,
'mem_len'
):
has_output_past
=
hasattr
(
self
.
config
,
'output_past'
)
and
self
.
config
.
output_past
has_multiple_outputs
=
len
(
outputs
)
>
1
has_mem_len
=
hasattr
(
self
,
'mem_len'
)
if
has_output_past
and
has_multiple_outputs
and
not
has_mem_len
:
return
True
# TODO: Add cases for (xlnet, transfo_xl) using mem_len
return
False
...
...
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