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
eefcecaa
Unverified
Commit
eefcecaa
authored
Oct 12, 2022
by
Sanchit Gandhi
Committed by
GitHub
Oct 12, 2022
Browse files
[Examples] Fix typos in run speech recognition seq2seq (#19514)
parent
72153ba6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
...orch/speech-recognition/run_speech_recognition_seq2seq.py
+4
-4
No files found.
examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
View file @
eefcecaa
...
@@ -195,7 +195,7 @@ class DataCollatorSpeechSeq2SeqWithPadding:
...
@@ -195,7 +195,7 @@ class DataCollatorSpeechSeq2SeqWithPadding:
Data collator that will dynamically pad the inputs received.
Data collator that will dynamically pad the inputs received.
Args:
Args:
processor ([`Wav2Vec2Processor`])
processor ([`Wav2Vec2Processor`])
The processor used for proc
c
essing the data.
The processor used for processing the data.
decoder_start_token_id (`int`)
decoder_start_token_id (`int`)
The begin-of-sentence of the decoder.
The begin-of-sentence of the decoder.
"""
"""
...
@@ -204,7 +204,7 @@ class DataCollatorSpeechSeq2SeqWithPadding:
...
@@ -204,7 +204,7 @@ class DataCollatorSpeechSeq2SeqWithPadding:
decoder_start_token_id
:
int
decoder_start_token_id
:
int
def
__call__
(
self
,
features
:
List
[
Dict
[
str
,
Union
[
List
[
int
],
torch
.
Tensor
]]])
->
Dict
[
str
,
torch
.
Tensor
]:
def
__call__
(
self
,
features
:
List
[
Dict
[
str
,
Union
[
List
[
int
],
torch
.
Tensor
]]])
->
Dict
[
str
,
torch
.
Tensor
]:
# split inputs and labels since they have to be of different leng
h
ts and need
# split inputs and labels since they have to be of different lengt
h
s and need
# different padding methods
# different padding methods
input_features
=
[{
"input_values"
:
feature
[
"input_values"
]}
for
feature
in
features
]
input_features
=
[{
"input_values"
:
feature
[
"input_values"
]}
for
feature
in
features
]
label_features
=
[{
"input_ids"
:
feature
[
"labels"
]}
for
feature
in
features
]
label_features
=
[{
"input_ids"
:
feature
[
"labels"
]}
for
feature
in
features
]
...
@@ -271,7 +271,7 @@ def main():
...
@@ -271,7 +271,7 @@ def main():
transformers
.
utils
.
logging
.
set_verbosity_info
()
transformers
.
utils
.
logging
.
set_verbosity_info
()
logger
.
info
(
"Training/evaluation parameters %s"
,
training_args
)
logger
.
info
(
"Training/evaluation parameters %s"
,
training_args
)
# 3. Detecting last checkpoint and eventualy continue from last checkpoint
# 3. Detecting last checkpoint and eventual
l
y continue from last checkpoint
last_checkpoint
=
None
last_checkpoint
=
None
if
os
.
path
.
isdir
(
training_args
.
output_dir
)
and
training_args
.
do_train
and
not
training_args
.
overwrite_output_dir
:
if
os
.
path
.
isdir
(
training_args
.
output_dir
)
and
training_args
.
do_train
and
not
training_args
.
overwrite_output_dir
:
last_checkpoint
=
get_last_checkpoint
(
training_args
.
output_dir
)
last_checkpoint
=
get_last_checkpoint
(
training_args
.
output_dir
)
...
@@ -360,7 +360,7 @@ def main():
...
@@ -360,7 +360,7 @@ def main():
if
model_args
.
freeze_feature_encoder
:
if
model_args
.
freeze_feature_encoder
:
model
.
freeze_feature_encoder
()
model
.
freeze_feature_encoder
()
# 6. Resample speech dataset if nec
a
ssary
# 6. Resample speech dataset if nec
e
ssary
dataset_sampling_rate
=
next
(
iter
(
raw_datasets
.
values
())).
features
[
data_args
.
audio_column_name
].
sampling_rate
dataset_sampling_rate
=
next
(
iter
(
raw_datasets
.
values
())).
features
[
data_args
.
audio_column_name
].
sampling_rate
if
dataset_sampling_rate
!=
feature_extractor
.
sampling_rate
:
if
dataset_sampling_rate
!=
feature_extractor
.
sampling_rate
:
raw_datasets
=
raw_datasets
.
cast_column
(
raw_datasets
=
raw_datasets
.
cast_column
(
...
...
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