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
96d4fa46
Unverified
Commit
96d4fa46
authored
Feb 16, 2023
by
Jonatas Grosman
Committed by
GitHub
Feb 16, 2023
Browse files
[WhisperModel] fix bug in reshaping labels (#21653)
fix bug in reshaping labels
parent
fcfd4ec7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/whisper/modeling_whisper.py
src/transformers/models/whisper/modeling_whisper.py
+1
-1
No files found.
src/transformers/models/whisper/modeling_whisper.py
View file @
96d4fa46
...
...
@@ -1211,7 +1211,7 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel):
loss
=
None
if
labels
is
not
None
:
loss_fct
=
CrossEntropyLoss
()
loss
=
loss_fct
(
lm_logits
.
view
(
-
1
,
self
.
config
.
vocab_size
),
labels
.
view
(
-
1
))
loss
=
loss_fct
(
lm_logits
.
view
(
-
1
,
self
.
config
.
vocab_size
),
labels
.
reshape
(
-
1
))
if
not
return_dict
:
output
=
(
lm_logits
,)
+
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