LVC Block
LVCBlock
Bases: Module
The location-variable convolutions block.
To efficiently capture the local information of the condition, location-variable convolution (LVC) obtained better sound quality and speed while maintaining the model size. The kernels of the LVC layers are predicted using a kernel predictor that takes the log-mel-spectrogram as the input. The kernel predictor is connected to a residual stack. One kernel predictor simultaneously predicts the kernels of all LVC layers in one residual stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_channels |
int
|
The number of input channels. |
required |
cond_channels |
int
|
The number of conditioning channels. |
required |
stride |
int
|
The stride of the convolutional layers. |
required |
dilations |
List[int]
|
A list of dilation values for the convolutional layers. |
[1, 3, 9, 27]
|
lReLU_slope |
float
|
The slope of the LeakyReLU activation function. |
0.2
|
conv_kernel_size |
int
|
The kernel size of the convolutional layers. |
3
|
cond_hop_length |
int
|
The hop length of the conditioning sequence. |
256
|
kpnet_hidden_channels |
int
|
The number of hidden channels in the kernel predictor network. |
64
|
kpnet_conv_size |
int
|
The kernel size of the convolutional layers in the kernel predictor network. |
3
|
kpnet_dropout |
float
|
The dropout rate for the kernel predictor network. |
0.0
|
Attributes:
Name | Type | Description |
---|---|---|
cond_hop_length |
int
|
The hop length of the conditioning sequence. |
conv_layers |
int
|
The number of convolutional layers. |
conv_kernel_size |
int
|
The kernel size of the convolutional layers. |
kernel_predictor |
KernelPredictor
|
The kernel predictor network. |
convt_pre |
Sequential
|
The convolutional transpose layer. |
conv_blocks |
ModuleList
|
The list of convolutional blocks. |
Source code in models/vocoder/univnet/lvc_block.py
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
forward(x, c)
Forward propagation of the location-variable convolutions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input sequence (batch, in_channels, in_length). |
required |
c |
Tensor
|
The conditioning sequence (batch, cond_channels, cond_length). |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
The output sequence (batch, in_channels, in_length). |
Source code in models/vocoder/univnet/lvc_block.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
location_variable_convolution(x, kernel, bias, dilation=1, hop_size=256)
Perform location-variable convolution operation on the input sequence (x) using the local convolution kernel. Time: 414 μs ± 309 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each), test on NVIDIA V100.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input sequence (batch, in_channels, in_length). |
required |
kernel |
Tensor
|
The local convolution kernel (batch, in_channel, out_channels, kernel_size, kernel_length). |
required |
bias |
Tensor
|
The bias for the local convolution (batch, out_channels, kernel_length). |
required |
dilation |
int
|
The dilation of convolution. |
1
|
hop_size |
int
|
The hop_size of the conditioning sequence. |
256
|
Returns:
Type | Description |
---|---|
Tensor
|
The output sequence after performing local convolution. (batch, out_channels, in_length). |
Source code in models/vocoder/univnet/lvc_block.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
remove_weight_norm()
Remove weight normalization from the convolutional layers in the LVCBlock.
This method removes weight normalization from the kernel predictor and all convolutional layers in the LVCBlock.
Source code in models/vocoder/univnet/lvc_block.py
197 198 199 200 201 202 203 204 205 |
|