Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TensorSpeech
GitHub Repository: TensorSpeech/TensorFlowTTS
Path: blob/master/tensorflow_tts/configs/parallel_wavegan.py
1558 views
1
# -*- coding: utf-8 -*-
2
# Copyright 2020 TensorFlowTTS Team.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
"""ParallelWaveGAN Config object."""
16
17
18
from tensorflow_tts.configs import BaseConfig
19
20
21
class ParallelWaveGANGeneratorConfig(BaseConfig):
22
"""Initialize ParallelWaveGAN Generator Config."""
23
24
def __init__(
25
self,
26
out_channels=1,
27
kernel_size=3,
28
n_layers=30,
29
stacks=3,
30
residual_channels=64,
31
gate_channels=128,
32
skip_channels=64,
33
aux_channels=80,
34
aux_context_window=2,
35
dropout_rate=0.0,
36
use_bias=True,
37
use_causal_conv=False,
38
upsample_conditional_features=True,
39
upsample_params={"upsample_scales": [4, 4, 4, 4]},
40
initializer_seed=42,
41
**kwargs,
42
):
43
"""Init parameters for ParallelWaveGAN Generator model."""
44
self.out_channels = out_channels
45
self.kernel_size = kernel_size
46
self.n_layers = n_layers
47
self.stacks = stacks
48
self.residual_channels = residual_channels
49
self.gate_channels = gate_channels
50
self.skip_channels = skip_channels
51
self.aux_channels = aux_channels
52
self.aux_context_window = aux_context_window
53
self.dropout_rate = dropout_rate
54
self.use_bias = use_bias
55
self.use_causal_conv = use_causal_conv
56
self.upsample_conditional_features = upsample_conditional_features
57
self.upsample_params = upsample_params
58
self.initializer_seed = initializer_seed
59
60
61
class ParallelWaveGANDiscriminatorConfig(object):
62
"""Initialize ParallelWaveGAN Discriminator Config."""
63
64
def __init__(
65
self,
66
out_channels=1,
67
kernel_size=3,
68
n_layers=10,
69
conv_channels=64,
70
use_bias=True,
71
dilation_factor=1,
72
nonlinear_activation="LeakyReLU",
73
nonlinear_activation_params={"alpha": 0.2},
74
initializer_seed=42,
75
apply_sigmoid_at_last=False,
76
**kwargs,
77
):
78
"Init parameters for ParallelWaveGAN Discriminator model."
79
self.out_channels = out_channels
80
self.kernel_size = kernel_size
81
self.n_layers = n_layers
82
self.conv_channels = conv_channels
83
self.use_bias = use_bias
84
self.dilation_factor = dilation_factor
85
self.nonlinear_activation = nonlinear_activation
86
self.nonlinear_activation_params = nonlinear_activation_params
87
self.initializer_seed = initializer_seed
88
self.apply_sigmoid_at_last = apply_sigmoid_at_last
89
90