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
de8b06f9
Unverified
Commit
de8b06f9
authored
Apr 14, 2022
by
Sanchit Gandhi
Committed by
GitHub
Apr 14, 2022
Browse files
[SpeechEncoderDecoderModel] Fix bug in reshaping labels (#16748)
parent
048443db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py
...speech_encoder_decoder/modeling_speech_encoder_decoder.py
+1
-1
No files found.
src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py
View file @
de8b06f9
...
...
@@ -557,7 +557,7 @@ class SpeechEncoderDecoderModel(PreTrainedModel):
if
labels
is
not
None
:
logits
=
decoder_outputs
.
logits
if
return_dict
else
decoder_outputs
[
0
]
loss_fct
=
CrossEntropyLoss
()
loss
=
loss_fct
(
logits
.
reshape
(
-
1
,
self
.
decoder
.
config
.
vocab_size
),
labels
.
view
(
-
1
))
loss
=
loss_fct
(
logits
.
reshape
(
-
1
,
self
.
decoder
.
config
.
vocab_size
),
labels
.
reshape
(
-
1
))
if
not
return_dict
:
if
loss
is
not
None
:
...
...
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