synthesizer_train.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from pathlib import Path
  2. from synthesizer.hparams import hparams
  3. from synthesizer.train import train
  4. from utils.argutils import print_args
  5. import argparse
  6. if __name__ == "__main__":
  7. parser = argparse.ArgumentParser()
  8. parser.add_argument("run_id", type=str, help= \
  9. "Name for this model. By default, training outputs will be stored to saved_models/<run_id>/. If a model state "
  10. "from the same run ID was previously saved, the training will restart from there. Pass -f to overwrite saved "
  11. "states and restart from scratch.")
  12. parser.add_argument("syn_dir", type=Path, help= \
  13. "Path to the synthesizer directory that contains the ground truth mel spectrograms, "
  14. "the wavs and the embeds.")
  15. parser.add_argument("-m", "--models_dir", type=Path, default="saved_models", help=\
  16. "Path to the output directory that will contain the saved model weights and the logs.")
  17. parser.add_argument("-s", "--save_every", type=int, default=1000, help= \
  18. "Number of steps between updates of the model on the disk. Set to 0 to never save the "
  19. "model.")
  20. parser.add_argument("-b", "--backup_every", type=int, default=25000, help= \
  21. "Number of steps between backups of the model. Set to 0 to never make backups of the "
  22. "model.")
  23. parser.add_argument("-f", "--force_restart", action="store_true", help= \
  24. "Do not load any saved model and restart from scratch.")
  25. parser.add_argument("--hparams", default="", help=\
  26. "Hyperparameter overrides as a comma-separated list of name=value pairs")
  27. args = parser.parse_args()
  28. print_args(args, parser)
  29. args.hparams = hparams.parse(args.hparams)
  30. # Run the training
  31. train(**vars(args))