-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
46 lines (34 loc) · 1.02 KB
/
run.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
41
42
43
44
45
46
#!/usr/bin/env python
import argparse
import json
import wavenet
import wavenet.utils as utils
logger = utils.new_logger("run")
TARGETS = {
"train": wavenet.train_pipeline,
"get-data": utils.get_data,
"mp3-to-wav": utils.Mp3Converter,
}
CONFIGS = {
"train": "config/train.json",
"get-data": ...,
"mp3-to-wav": "config/mp3-to-wav.json",
}
def main():
"""Run WaveNet Pipeline/call designated targets"""
parser = argparse.ArgumentParser()
parser.add_argument("target", choices=TARGETS.keys(), type=str, default="demo")
parser.add_argument(
"--debug", type=bool, default=False, help="Flag for showing debug messages"
)
args = parser.parse_args()
with open(CONFIGS[args.target]) as config_file:
config = json.load(config_file)
if args.debug:
config["log_level"] = 10
else:
config["log_level"] = 20
# initiate target sequence with designated configuration
TARGETS[args.target](**config)
if __name__ == "__main__":
main()