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
fdd81aea
Unverified
Commit
fdd81aea
authored
Aug 04, 2023
by
Sanchit Gandhi
Committed by
GitHub
Aug 04, 2023
Browse files
[Whisper] Better error message for outdated generation config (#25298)
parent
fdaef336
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
src/transformers/models/whisper/modeling_whisper.py
src/transformers/models/whisper/modeling_whisper.py
+12
-0
No files found.
src/transformers/models/whisper/modeling_whisper.py
View file @
fdd81aea
...
@@ -1649,9 +1649,21 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel):
...
@@ -1649,9 +1649,21 @@ class WhisperForConditionalGeneration(WhisperPreTrainedModel):
generation_config
.
return_timestamps
=
False
generation_config
.
return_timestamps
=
False
if
language
is
not
None
:
if
language
is
not
None
:
if
not
hasattr
(
generation_config
,
"lang_to_id"
):
raise
ValueError
(
"The generation config is outdated and is thus not compatible with the `language` argument"
"to `generate`. Either set the language using the `forced_decoder_ids` in the model config, "
"or update the generation config as per the instructions https://github.com/huggingface/transformers/issues/25084#issuecomment-1664398224"
)
language
=
language
.
lower
()
language
=
language
.
lower
()
generation_config
.
language
=
language
generation_config
.
language
=
language
if
task
is
not
None
:
if
task
is
not
None
:
if
not
hasattr
(
generation_config
,
"task_to_id"
):
raise
ValueError
(
"The generation config is outdated and is thus not compatible with the `task` argument"
"to `generate`. Either set the task using the `forced_decoder_ids` in the model config, "
"or update the generation config as per the instructions https://github.com/huggingface/transformers/issues/25084#issuecomment-1664398224"
)
generation_config
.
task
=
task
generation_config
.
task
=
task
forced_decoder_ids
=
None
forced_decoder_ids
=
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