Skip to content

Commit

Permalink
[examples] set num workers via argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
ShengqiangLi authored and ShengqiangLi committed Feb 7, 2024
1 parent 7db9884 commit 8fed703
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion examples/aishell-3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
--train_data $data/train.txt \
--val_data $data/val.txt \
--speaker_table $data/speaker.txt \
--phone_table $data/phones.txt
--phone_table $data/phones.txt \
--num_workers 8
fi


Expand Down
5 changes: 3 additions & 2 deletions examples/baker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config=configs/v3.json

# Please download data from https://www.data-baker.com/data/index/TNtts, and
# set `raw_data_dir` to your data.
raw_data_dir=/mnt/mnt-data-1/binbin.zhang/data/BZNSYP
raw_data_dir=. # path to dataset directory
data=data
test_audio=test_audio
ckpt_step=200000
Expand Down Expand Up @@ -56,7 +56,8 @@ if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
--train_data $data/train.txt \
--val_data $data/val.txt \
--speaker_table $data/speaker.txt \
--phone_table $data/phones.txt
--phone_table $data/phones.txt \
--num_workers 8
fi


Expand Down
3 changes: 2 additions & 1 deletion examples/ljspeech/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
--train_data $data/train.txt \
--val_data $data/val.txt \
--speaker_table $data/speaker.txt \
--phone_table $data/phones.txt
--phone_table $data/phones.txt \
--num_workers 8
fi


Expand Down
3 changes: 2 additions & 1 deletion examples/multilingual/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
--train_data $data/train.txt \
--val_data $data/val.txt \
--speaker_table $data/speaker.txt \
--phone_table $data/phones.txt
--phone_table $data/phones.txt \
--num_workers 8
fi

if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
Expand Down
4 changes: 2 additions & 2 deletions wetts/vits/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def main():
collate_fn = TextAudioSpeakerCollate()
train_loader = DataLoader(
train_dataset,
num_workers=8,
num_workers=hps.num_workers,
shuffle=False,
pin_memory=True,
collate_fn=collate_fn,
Expand All @@ -77,7 +77,7 @@ def main():
hps.data)
eval_loader = DataLoader(
eval_dataset,
num_workers=8,
num_workers=hps.num_workers,
shuffle=False,
batch_size=hps.train.batch_size,
pin_memory=True,
Expand Down
5 changes: 5 additions & 0 deletions wetts/vits/utils/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def get_hparams(init=True):
type=str,
required=True,
help="phone table")
parser.add_argument('--num_workers',
default=8,
type=int,
help='num of subprocess workers for reading')
parser.add_argument(
"--speaker_table",
type=str,
Expand Down Expand Up @@ -218,6 +222,7 @@ def get_hparams(init=True):

hparams = HParams(**config)
hparams.model_dir = model_dir
hparams.num_workers = args.num_workers
return hparams


Expand Down

0 comments on commit 8fed703

Please sign in to comment.