Python hparams.hparams.parse() Examples
The following are 30
code examples of hparams.hparams.parse().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
hparams.hparams
, or try the search function
.
Example #1
Source File: train.py From vae_tacotron with MIT License | 6 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default=os.path.expanduser('.')) parser.add_argument('--input', default='training/train.txt') parser.add_argument('--model', default='tacotron') parser.add_argument('--name', help='Name of the run. Used for logging. Defaults to model name.') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--restore_step', type=int, help='Global step to restore from checkpoint.') parser.add_argument('--summary_interval', type=int, default=1, help='Steps between running summary ops.') parser.add_argument('--checkpoint_interval', type=int, default=1000, help='Steps between writing checkpoints.') parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.') parser.add_argument('--tf_log_level', type=int, default=1, help='Tensorflow C++ log level.') parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-%s' % run_name) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'train.log'), run_name, args.slack_url) hparams.parse(args.hparams) train(log_dir, args)
Example #2
Source File: preprocess.py From style-token_tacotron2 with MIT License | 6 votes |
def main(): print('initializing preprocessing..') parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--dataset', default='thchs30') parser.add_argument('--language', default='en_US') parser.add_argument('--voice', default='female') parser.add_argument('--reader', default='mary_ann') parser.add_argument('--merge_books', default='False') parser.add_argument('--book', default='northandsouth') parser.add_argument('--output', default='training_data') parser.add_argument('--n_jobs', type=int, default=cpu_count()) args = parser.parse_args() modified_hp = hparams.parse(args.hparams) assert args.merge_books in ('False', 'True') run_preprocess(args, modified_hp)
Example #3
Source File: preprocess.py From tacotron2-mandarin-griffin-lim with MIT License | 6 votes |
def main(): print('initializing preprocessing..') parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--dataset', default='BIAOBEI') parser.add_argument('--language', default='en_US') parser.add_argument('--voice', default='female') parser.add_argument('--reader', default='mary_ann') parser.add_argument('--merge_books', default='False') parser.add_argument('--book', default='northandsouth') parser.add_argument('--output', default='training_data') parser.add_argument('--n_jobs', type=int, default=cpu_count()) args = parser.parse_args() modified_hp = hparams.parse(args.hparams) assert args.merge_books in ('False', 'True') run_preprocess(args, modified_hp)
Example #4
Source File: train.py From tacotron with MIT License | 6 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default=os.path.expanduser('~/tacotron')) parser.add_argument('--input', default='training/train.txt') parser.add_argument('--model', default='tacotron') parser.add_argument('--name', help='Name of the run. Used for logging. Defaults to model name.') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--restore_step', type=int, help='Global step to restore from checkpoint.') parser.add_argument('--summary_interval', type=int, default=100, help='Steps between running summary ops.') parser.add_argument('--checkpoint_interval', type=int, default=1000, help='Steps between writing checkpoints.') parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.') parser.add_argument('--tf_log_level', type=int, default=1, help='Tensorflow C++ log level.') parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-%s' % run_name) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'train.log'), run_name, args.slack_url) hparams.parse(args.hparams) train(log_dir, args)
Example #5
Source File: train.py From libfaceid with MIT License | 6 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default=os.path.expanduser('~/tacotron')) parser.add_argument('--input', default='training/train.txt') parser.add_argument('--model', default='tacotron') parser.add_argument('--name', help='Name of the run. Used for logging. Defaults to model name.') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--restore_step', type=int, help='Global step to restore from checkpoint.') parser.add_argument('--summary_interval', type=int, default=100, help='Steps between running summary ops.') parser.add_argument('--checkpoint_interval', type=int, default=1000, help='Steps between writing checkpoints.') parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.') parser.add_argument('--tf_log_level', type=int, default=1, help='Tensorflow C++ log level.') parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-%s' % run_name) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'train.log'), run_name, args.slack_url) hparams.parse(args.hparams) train(log_dir, args)
Example #6
Source File: preprocess.py From Tacotron-2 with MIT License | 6 votes |
def main(): print('initializing preprocessing..') parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--dataset', default='LJSpeech-1.1') parser.add_argument('--language', default='en_US') parser.add_argument('--voice', default='female') parser.add_argument('--reader', default='mary_ann') parser.add_argument('--merge_books', default='False') parser.add_argument('--book', default='northandsouth') parser.add_argument('--output', default='training_data') parser.add_argument('--n_jobs', type=int, default=cpu_count()) args = parser.parse_args() modified_hp = hparams.parse(args.hparams) assert args.merge_books in ('False', 'True') run_preprocess(args, modified_hp)
Example #7
Source File: train.py From tacotron2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def main(): args = docopt(__doc__) print("Command line args:\n", args) checkpoint_dir = args["--checkpoint-dir"] data_root = args["--data-root"] dataset_name = args["--dataset"] assert dataset_name in ["blizzard2012", "ljspeech"] corpus = importlib.import_module("datasets." + dataset_name) corpus_instance = corpus.instantiate(in_dir="", out_dir=data_root) hparams.parse(args["--hparams"]) print(hparams_debug_string()) tf.logging.set_verbosity(tf.logging.INFO) train_and_evaluate(hparams, checkpoint_dir, corpus_instance.training_source_files, corpus_instance.training_target_files, corpus_instance.validation_source_files, corpus_instance.validation_target_files)
Example #8
Source File: train.py From arabic-tacotron-tts with MIT License | 6 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default=os.path.expanduser('~/tacotron')) parser.add_argument('--input', default='training/train.txt') parser.add_argument('--model', default='tacotron') parser.add_argument('--name', help='Name of the run. Used for logging. Defaults to model name.') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--restore_step', type=bool, default=True, help='Global step to restore from checkpoint.') parser.add_argument('--summary_interval', type=int, default=100, help='Steps between running summary ops.') parser.add_argument('--checkpoint_interval', type=int, default=1000, help='Steps between writing checkpoints.') parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.') parser.add_argument('--tf_log_level', type=int, default=1, help='Tensorflow C++ log level.') parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-%s' % run_name) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'train.log'), run_name, args.slack_url) hparams.parse(args.hparams) train(log_dir, args)
Example #9
Source File: train_postnet.py From tacotron2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def main(): args = docopt(__doc__) print("Command line args:\n", args) checkpoint_dir = args["--checkpoint-dir"] data_root = args["--data-root"] dataset_name = args["--dataset"] assert dataset_name in ["blizzard2012", "ljspeech"] corpus = importlib.import_module("datasets." + dataset_name) corpus_instance = corpus.instantiate(in_dir="", out_dir=data_root) hparams.parse(args["--hparams"]) print(hparams_debug_string()) tf.logging.set_verbosity(tf.logging.INFO) train_and_evaluate(hparams, checkpoint_dir, corpus_instance.training_target_files, corpus_instance.validation_target_files)
Example #10
Source File: synthesize.py From tacotron2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def main(): args = docopt(__doc__) print("Command line args:\n", args) checkpoint_dir = args["--checkpoint-dir"] postnet_checkpoint_dir = args["--postnet-checkpoint-dir"] data_root = args["--data-root"] dataset_name = args["--dataset"] assert dataset_name in ["blizzard2012"] corpus = importlib.import_module("datasets." + dataset_name) corpus_instance = corpus.instantiate(in_dir="", out_dir=data_root) hparams.parse(args["--hparams"]) print(hparams_debug_string()) tf.logging.set_verbosity(tf.logging.INFO) predict(hparams, checkpoint_dir, postnet_checkpoint_dir, corpus_instance.test_source_files, corpus_instance.test_target_files, )
Example #11
Source File: train.py From tacotron with MIT License | 5 votes |
def get_git_commit(): subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()[:10] log('Git commit: %s' % commit) return commit
Example #12
Source File: train.py From vae_tacotron with MIT License | 5 votes |
def get_git_commit(): subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()[:10] log('Git commit: %s' % commit) return commit
Example #13
Source File: synthesize.py From gmvae_tacotron with MIT License | 5 votes |
def tacotron_synthesize(args): hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' output_dir = 'tacotron_' + args.output_dir try: checkpoint_path = tf.train.get_checkpoint_state(args.checkpoint).model_checkpoint_path print('loaded model at {}'.format(checkpoint_path)) except: raise AssertionError('Cannot restore checkpoint: {}, did you train a model?'.format(args.checkpoint)) if args.mode == 'eval': run_eval(args, checkpoint_path, output_dir) else: run_synthesis(args, checkpoint_path, output_dir)
Example #14
Source File: train.py From gmvae_tacotron with MIT License | 5 votes |
def tacotron_train(args): hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-{}'.format(run_name)) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'Terminal_train_log'), run_name) train(log_dir, args)
Example #15
Source File: wavenet_preprocess.py From style-token_tacotron2 with MIT License | 5 votes |
def main(): print('initializing preprocessing..') parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--input_dir', default='LJSpeech-1.1/wavs') parser.add_argument('--output', default='tacotron_output/gta/') parser.add_argument('--n_jobs', type=int, default=cpu_count()) args = parser.parse_args() modified_hp = hparams.parse(args.hparams) run_preprocess(args, modified_hp)
Example #16
Source File: synthesize.py From style-token_tacotron2 with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' run_name = args.name or args.tacotron_name or args.model taco_checkpoint = os.path.join('logs-' + run_name, 'taco_' + args.checkpoint) run_name = args.name or args.wavenet_name or args.model wave_checkpoint = os.path.join('logs-' + run_name, 'wave_' + args.checkpoint) return taco_checkpoint, wave_checkpoint, modified_hp
Example #17
Source File: test_wavenet_feeder.py From style-token_tacotron2 with MIT License | 5 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--metadata', default='tacotron_output/gta/map.txt') args = parser.parse_args() modified_hparams = hparams.parse(args.hparams) run(args, modified_hparams)
Example #18
Source File: interval_synthesis.py From style-token_tacotron2 with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' run_name = args.name or args.tacotron_name or args.model taco_checkpoint = os.path.join('logs-' + run_name, 'taco_' + args.checkpoint) run_name = args.name or args.wavenet_name or args.model wave_checkpoint = os.path.join('logs-' + run_name, 'wave_' + args.checkpoint) return taco_checkpoint, wave_checkpoint, modified_hp
Example #19
Source File: predict_mel.py From self-attention-tacotron with BSD 3-Clause "New" or "Revised" License | 5 votes |
def main(): args = docopt(__doc__) print("Command line args:\n", args) checkpoint_dir = args["--checkpoint-dir"] checkpoint_path = args["--checkpoint"] source_data_root = args["--source-data-root"] target_data_root = args["--target-data-root"] selected_list_dir = args["--selected-list-dir"] output_dir = args["--output-dir"] selected_list_filename = args["--selected-list-filename"] or "test.csv" tf.logging.set_verbosity(tf.logging.INFO) if args["--hparam-json-file"]: with open(args["--hparam-json-file"]) as f: json = "".join(f.readlines()) hparams.parse_json(json) hparams.parse(args["--hparams"]) tf.logging.info(hparams_debug_string()) tf.logging.info(f"A selected list file to use: {os.path.join(selected_list_dir, selected_list_filename)}") test_list = list(load_key_list(selected_list_filename, selected_list_dir)) test_source_files = [os.path.join(source_data_root, f"{key}.{hparams.source_file_extension}") for key in test_list] test_target_files = [os.path.join(target_data_root, f"{key}.{hparams.target_file_extension}") for key in test_list] predict(hparams, checkpoint_dir, checkpoint_path, output_dir, test_source_files, test_target_files)
Example #20
Source File: eval.py From tacotron with MIT License | 5 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--checkpoint', required=True, help='Path to model checkpoint') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' hparams.parse(args.hparams) run_eval(args)
Example #21
Source File: train.py From tacotron2-mandarin-griffin-lim with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) os.environ['CUDA_VISIBLE_DEVICES'] = '0' run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-{}'.format(run_name)) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'Terminal_train_log'), run_name, args.slack_url) return log_dir, modified_hp
Example #22
Source File: synthesize.py From tacotron2-mandarin-griffin-lim with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' os.environ['CUDA_VISIBLE_DEVICES'] = '0' run_name = args.name or args.tacotron_name or args.model taco_checkpoint = os.path.join('logs-' + run_name, 'taco_' + args.checkpoint) run_name = args.name or args.wavenet_name or args.model wave_checkpoint = os.path.join('logs-' + run_name, 'wave_' + args.checkpoint) return taco_checkpoint, wave_checkpoint, modified_hp
Example #23
Source File: train.py From Tacotron-2 with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = str(args.tf_log_level) run_name = args.name or args.model log_dir = os.path.join(args.base_dir, 'logs-{}'.format(run_name)) os.makedirs(log_dir, exist_ok=True) infolog.init(os.path.join(log_dir, 'Terminal_train_log'), run_name, args.slack_url) return log_dir, modified_hp
Example #24
Source File: test_wavenet_feeder.py From Tacotron-2 with MIT License | 5 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--metadata', default='tacotron_output/gta/map.txt') args = parser.parse_args() modified_hparams = hparams.parse(args.hparams) run(args, modified_hparams)
Example #25
Source File: synthesize.py From Tacotron-2 with MIT License | 5 votes |
def prepare_run(args): modified_hp = hparams.parse(args.hparams) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' run_name = args.name or args.tacotron_name or args.model taco_checkpoint = os.path.join('logs-' + run_name, 'taco_' + args.checkpoint) run_name = args.name or args.wavenet_name or args.model wave_checkpoint = os.path.join('logs-' + run_name, 'wave_' + args.checkpoint) return taco_checkpoint, wave_checkpoint, modified_hp
Example #26
Source File: wavenet_preprocess.py From Tacotron-2 with MIT License | 5 votes |
def main(): print('initializing preprocessing..') parser = argparse.ArgumentParser() parser.add_argument('--base_dir', default='') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') parser.add_argument('--input_dir', default='LJSpeech-1.1/wavs') parser.add_argument('--output', default='tacotron_output/gta/') parser.add_argument('--n_jobs', type=int, default=cpu_count()) args = parser.parse_args() modified_hp = hparams.parse(args.hparams) run_preprocess(args, modified_hp)
Example #27
Source File: train.py From arabic-tacotron-tts with MIT License | 5 votes |
def get_git_commit(): subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()[:10] log('Git commit: %s' % commit) return commit
Example #28
Source File: eval.py From arabic-tacotron-tts with MIT License | 5 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--checkpoint', required=True, help='Path to model checkpoint') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' hparams.parse(args.hparams) run_eval(args)
Example #29
Source File: train.py From libfaceid with MIT License | 5 votes |
def get_git_commit(): subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()[:10] log('Git commit: %s' % commit) return commit
Example #30
Source File: eval.py From libfaceid with MIT License | 5 votes |
def main(): parser = argparse.ArgumentParser() parser.add_argument('--checkpoint', required=True, help='Path to model checkpoint') parser.add_argument('--hparams', default='', help='Hyperparameter overrides as a comma-separated list of name=value pairs') args = parser.parse_args() os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' hparams.parse(args.hparams) run_eval(args)