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
parler-tts
Commits
d112db94
Commit
d112db94
authored
Mar 05, 2024
by
Yoach Lacombe
Browse files
add group by length sampler
parent
6f5a0277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
run_stable_speech_training.py
run_stable_speech_training.py
+4
-1
No files found.
run_stable_speech_training.py
View file @
d112db94
...
...
@@ -55,6 +55,7 @@ from transformers import (
Seq2SeqTrainingArguments
,
)
from
transformers.trainer_utils
import
is_main_process
from
transformers.trainer_pt_utils
import
LengthGroupedSampler
from
transformers
import
pipeline
from
transformers.optimization
import
get_scheduler
from
transformers.utils
import
check_min_version
,
send_example_telemetry
...
...
@@ -1200,7 +1201,8 @@ def main():
# Prepare everything with accelerate
model
,
optimizer
,
lr_scheduler
=
accelerator
.
prepare
(
model
,
optimizer
,
lr_scheduler
)
sampler
=
LengthGroupedSampler
(
per_device_train_batch_size
,
lengths
=
vectorized_datasets
[
"train"
][
"target_length"
])
logger
.
info
(
"***** Running training *****"
)
logger
.
info
(
f
" Num examples =
{
total_train_steps
*
train_batch_size
*
gradient_accumulation_steps
}
"
)
...
...
@@ -1343,6 +1345,7 @@ def main():
vectorized_datasets
[
"train"
],
collate_fn
=
data_collator
,
batch_size
=
per_device_train_batch_size
,
sampler
=
sampler
,
num_workers
=
training_args
.
dataloader_num_workers
,
pin_memory
=
training_args
.
dataloader_pin_memory
,
)
...
...
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