MCPcopy
hub / github.com/descriptinc/descript-audio-codec / Decoder

Class Decoder

dac/model/dac.py:115–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115class Decoder(nn.Module):
116 def __init__(
117 self,
118 input_channel,
119 channels,
120 rates,
121 d_out: int = 1,
122 ):
123 super().__init__()
124
125 # Add first conv layer
126 layers = [WNConv1d(input_channel, channels, kernel_size=7, padding=3)]
127
128 # Add upsampling + MRF blocks
129 for i, stride in enumerate(rates):
130 input_dim = channels // 2**i
131 output_dim = channels // 2 ** (i + 1)
132 layers += [DecoderBlock(input_dim, output_dim, stride)]
133
134 # Add final conv layer
135 layers += [
136 Snake1d(output_dim),
137 WNConv1d(output_dim, d_out, kernel_size=7, padding=3),
138 nn.Tanh(),
139 ]
140
141 self.model = nn.Sequential(*layers)
142
143 def forward(self, x):
144 return self.model(x)
145
146
147class DAC(BaseModel, CodecMixin):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected