Skip to content

Commit 1f2c99f

Browse files
committed
hparams option for preprocess
1 parent 4b4b427 commit 1f2c99f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

preprocess.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
77
options:
88
--num_workers=<n> Num workers.
9+
--hparams=<parmas> Hyper parameters [default: ].
910
-h, --help Show help message.
1011
"""
1112
from docopt import docopt
1213
import os
1314
from multiprocessing import cpu_count
1415
from tqdm import tqdm
1516
import importlib
16-
from hparams import hparams
17+
from hparams import hparams, hparams_debug_string
1718

1819

1920
def preprocess(mod, in_dir, out_root, num_workers):
@@ -42,6 +43,19 @@ def write_metadata(metadata, out_dir):
4243
num_workers = args["--num_workers"]
4344
num_workers = cpu_count() if num_workers is None else int(num_workers)
4445

46+
# Override hyper parameters
47+
hparams.parse(args["--hparams"])
48+
print(hparams_debug_string())
49+
assert hparams.name == "deepvoice3"
50+
51+
# Presets
52+
if hparams.preset is not None and hparams.preset != "":
53+
preset = hparams.presets[hparams.preset]
54+
import json
55+
hparams.parse_json(json.dumps(preset))
56+
print("Override hyper parameters with preset \"{}\": {}".format(
57+
hparams.preset, json.dumps(preset, indent=4)))
58+
4559
assert name in ["jsut", "ljspeech", "vctk"]
4660
mod = importlib.import_module(name)
4761
preprocess(mod, in_dir, out_dir, num_workers)

0 commit comments

Comments
 (0)