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
eeaa402c
Commit
eeaa402c
authored
Dec 23, 2019
by
patrickvonplaten
Browse files
rename comments
parent
7bb42712
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-2
No files found.
src/transformers/modeling_utils.py
View file @
eeaa402c
...
@@ -731,7 +731,7 @@ class PreTrainedModel(nn.Module):
...
@@ -731,7 +731,7 @@ class PreTrainedModel(nn.Module):
outputs
=
self
(
**
model_inputs
)
outputs
=
self
(
**
model_inputs
)
next_token_logits
=
outputs
[
0
][:,
-
1
,
:]
next_token_logits
=
outputs
[
0
][:,
-
1
,
:]
# if model has past, then set the past
p
ar
ameter
to speed up decoding
# if model has past, then set the past
v
ar
iable
to speed up decoding
if
self
.
_has_past
(
outputs
):
if
self
.
_has_past
(
outputs
):
past
=
outputs
[
1
]
past
=
outputs
[
1
]
...
@@ -818,7 +818,7 @@ class PreTrainedModel(nn.Module):
...
@@ -818,7 +818,7 @@ class PreTrainedModel(nn.Module):
outputs
=
self
(
**
model_inputs
)
# (batch_size * num_beams, cur_len, vocab_size)
outputs
=
self
(
**
model_inputs
)
# (batch_size * num_beams, cur_len, vocab_size)
scores
=
outputs
[
0
][:,
-
1
,
:]
# (batch_size * num_beams, vocab_size)
scores
=
outputs
[
0
][:,
-
1
,
:]
# (batch_size * num_beams, vocab_size)
# if model has past, then set the past
p
ar
ameter
to speed up decoding
# if model has past, then set the past
v
ar
iable
to speed up decoding
if
self
.
_has_past
(
outputs
):
if
self
.
_has_past
(
outputs
):
past
=
outputs
[
1
]
past
=
outputs
[
1
]
...
...
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