forked from IMLHF/Real-Time-Voice-Cloning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencoder_train.py
40 lines (36 loc) · 2.43 KB
/
encoder_train.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from utils.argutils import print_args
from encoder.train import train
from pathlib import Path
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Trains the speaker encoder. You must have run encoder_preprocess.py first.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("--run_id", type=str, default='1', help="Name for this model instance. "
"If a model state from the same run ID was previously saved, the training "
"will restart from there. Pass -f to overwrite saved states and restart "
"from scratch.")
parser.add_argument("--train_data_root", type=Path, required=True, help="Path to the output "
"directory of train data. If you left the default output "
"directory when preprocessing, it should be <datasets_root>/SV2TTS/encoder_train/.")
parser.add_argument("--test_data_root", type=Path, required=True, help="Path to the output "
"directory of test data. it should be <datasets_root>/SV2TTS/encoder_test/.")
parser.add_argument("-m", "--models_dir", type=Path, default="encoder/saved_models/", help="Path "
"to the output directory that will contain the saved model weights, as well as "
"backups of those weights and plots generated during training.")
parser.add_argument("-v", "--vis_every", type=int, default=100,
help="Number of steps between updates of the loss and the plots.")
parser.add_argument("-s", "--save_every", type=int, default=1000, help="Number of steps between "
"updates of the model on the disk. Set to 0 to never save the model.")
parser.add_argument("-b", "--backup_every", type=int, default=10000, help="Number of steps between "
"backups of the model. Set to 0 to never make backups of the model.")
parser.add_argument("-f", "--force_restart", action="store_true", help="Do not load any saved model.")
parser.add_argument("--visdom_server", type=str, default="http://localhost")
parser.add_argument("--no_visdom", action="store_true",default=False, help="Disable visdom.")
args = parser.parse_args()
# Process the arguments
args.models_dir.mkdir(exist_ok=True)
# Run the training
print_args(args, parser)
train(**vars(args))