本文整理匯總了Python中hparams.hparams.parse方法的典型用法代碼示例。如果您正苦於以下問題:Python hparams.parse方法的具體用法?Python hparams.parse怎麽用?Python hparams.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hparams.hparams
的用法示例。
在下文中一共展示了hparams.parse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例2: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例3: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例4: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例5: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例6: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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, )
示例7: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例8: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例9: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例10: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--checkpoint', required=True, help='Path to model checkpoint')
parser.add_argument('--reference_audio', required=True)
parser.add_argument('--output')
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)
示例11: get_git_commit
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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
示例12: tacotron_synthesize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例13: tacotron_train
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例14: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)
示例15: main
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import parse [as 別名]
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)