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
57edd84b
Unverified
Commit
57edd84b
authored
May 17, 2024
by
Sanchit Gandhi
Committed by
GitHub
May 17, 2024
Browse files
[whisper] fix multilingual fine-tuning (#30865)
* [whisper] fix multilingual fine-tuning * config ids as well
parent
977ce58a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
...orch/speech-recognition/run_speech_recognition_seq2seq.py
+5
-6
No files found.
examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
View file @
57edd84b
...
@@ -425,12 +425,8 @@ def main():
...
@@ -425,12 +425,8 @@ def main():
if
hasattr
(
model
.
generation_config
,
"is_multilingual"
)
and
model
.
generation_config
.
is_multilingual
:
if
hasattr
(
model
.
generation_config
,
"is_multilingual"
)
and
model
.
generation_config
.
is_multilingual
:
# We only need to set the language and task ids in a multilingual setting
# We only need to set the language and task ids in a multilingual setting
tokenizer
.
set_prefix_tokens
(
language
=
data_args
.
language
,
task
=
data_args
.
task
)
tokenizer
.
set_prefix_tokens
(
language
=
data_args
.
language
,
task
=
data_args
.
task
)
model
.
generation_config
.
update
(
model
.
generation_config
.
language
=
data_args
.
language
**
{
model
.
generation_config
.
task
=
data_args
.
task
"language"
:
data_args
.
language
,
"task"
:
data_args
.
task
,
}
)
elif
data_args
.
language
is
not
None
:
elif
data_args
.
language
is
not
None
:
raise
ValueError
(
raise
ValueError
(
"Setting language token for an English-only checkpoint is not permitted. The language argument should "
"Setting language token for an English-only checkpoint is not permitted. The language argument should "
...
@@ -444,6 +440,9 @@ def main():
...
@@ -444,6 +440,9 @@ def main():
"Please use the `language` and `task` arguments instead"
"Please use the `language` and `task` arguments instead"
)
)
model
.
generation_config
.
forced_decoder_ids
=
model_args
.
forced_decoder_ids
model
.
generation_config
.
forced_decoder_ids
=
model_args
.
forced_decoder_ids
else
:
model
.
generation_config
.
forced_decoder_ids
=
None
model
.
config
.
forced_decoder_ids
=
None
if
model_args
.
suppress_tokens
is
not
None
:
if
model_args
.
suppress_tokens
is
not
None
:
logger
.
warning
(
logger
.
warning
(
...
...
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