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
6e161955
Unverified
Commit
6e161955
authored
Jul 23, 2020
by
Sylvain Gugger
Committed by
GitHub
Jul 23, 2020
Browse files
Fix #5974 (#5999)
parent
e168488a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
src/transformers/modeling_transfo_xl.py
src/transformers/modeling_transfo_xl.py
+1
-2
No files found.
src/transformers/modeling_transfo_xl.py
View file @
6e161955
...
...
@@ -1045,14 +1045,13 @@ class TransfoXLLMHeadModel(TransfoXLPreTrainedModel):
last_hidden
=
transformer_outputs
[
0
]
pred_hid
=
last_hidden
[:,
-
tgt_len
:]
outputs
=
transformer_outputs
[
1
:]
softmax_output
=
self
.
crit
(
pred_hid
,
labels
)
prediction_scores
=
softmax_output
.
view
(
bsz
,
tgt_len
,
-
1
)
if
labels
is
None
else
()
loss
=
softmax_output
.
view
(
bsz
,
tgt_len
-
1
)
if
labels
is
not
None
else
None
if
return_tuple
:
output
=
(
prediction_scores
,)
+
outputs
[
1
:]
output
=
(
prediction_scores
,)
+
transformer_
outputs
[
1
:]
return
((
loss
,)
+
output
)
if
loss
is
not
None
else
output
return
TransfoXLLMHeadModelOutput
(
...
...
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