-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhparams.py
102 lines (82 loc) · 2.32 KB
/
hparams.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import json
def create_harmonic_hparams(hparams_string=None, verbose=False):
"""Create model hyperparameters. Parse nondefault from given string."""
hparams = dict(
type=0,
layers=3,
blocks=2,
dilation_channels=130,
residual_channels=130,
skip_channels=240,
input_channel=60,
condition_channel=621,
output_channel=240,
sample_channel=60,
initial_kernel=10,
kernel_size=2,
bias=True
)
return dict2obj(hparams)
def create_aperiodic_hparams( hparams_string=None, verbose=False):
"""Create model hyperparameters. Parse nondefault from given string."""
hparams = dict(
type=1,
layers=3,
blocks=2,
dilation_channels=20,
residual_channels=20,
skip_channels=16,
input_channel=64,
condition_channel=621,
output_channel=16,
sample_channel=4,
initial_kernel=10,
kernel_size=2,
bias=True
)
return dict2obj(hparams)
def create_vuv_hparams( hparams_string=None, verbose=False):
"""Create model hyperparameters. Parse nondefault from given string."""
hparams = dict(
type=2,
layers=3,
blocks=2,
dilation_channels=20,
residual_channels=20,
skip_channels=4,
input_channel=65,
condition_channel=621,
output_channel=1,
sample_channel=1,
initial_kernel=10,
kernel_size=2,
bias=True
)
return dict2obj(hparams)
def create_f0_hparams(hparams_string=None, verbose=False):
"""Create model hyperparameters. Parse nondefault from given string."""
hparams = dict(
type=3,
layers=7,
blocks=2,
dilation_channels=100,
residual_channels=100,
skip_channels=100,
input_channel=1,
condition_channel=708,
output_channel=4,
sample_channel=1,
initial_kernel=20,
kernel_size=2,
bias=True
)
return dict2obj(hparams)
# declaringa a class
class obj:
# constructor
def __init__(self, dict1):
self.__dict__.update(dict1)
def dict2obj(dict1):
# using json.loads method and passing json.dumps
# method and custom object hook as arguments
return json.loads(json.dumps(dict1), object_hook=obj)