MCPcopy Create free account
hub / github.com/FireRedTeam/FireRedTTS2 / __init__

Method __init__

fireredtts2/codec/decoder.py:106–136  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        out_channels: int = None,
        dropout: float = 0.0,
    )

Source from the content-addressed store, hash-verified

104# A causal variant of ResnetBlock
105class CausalResnetBlock(nn.Module):
106 def __init__(
107 self,
108 in_channels: int,
109 out_channels: int = None,
110 dropout: float = 0.0,
111 ):
112 super().__init__()
113 self.in_channels = in_channels
114 out_channels = in_channels if out_channels is None else out_channels
115 self.out_channels = out_channels
116
117 self.block1 = nn.Sequential(
118 Transpose(1, 2),
119 nn.LayerNorm(in_channels),
120 Transpose(1, 2),
121 nn.SiLU(),
122 CausalConv1d(in_channels, out_channels, kernel_size=3),
123 )
124
125 self.block2 = nn.Sequential(
126 Transpose(1, 2),
127 nn.LayerNorm(out_channels),
128 Transpose(1, 2),
129 nn.SiLU(),
130 nn.Dropout(dropout),
131 CausalConv1d(out_channels, out_channels, kernel_size=3),
132 )
133 if self.in_channels != self.out_channels:
134 self.nin_shortcut = torch.nn.Conv1d(
135 in_channels, out_channels, kernel_size=1, stride=1, padding=0
136 )
137
138 def forward(self, x: torch.Tensor):
139 """

Callers

nothing calls this directly

Calls 3

TransposeClass · 0.85
CausalConv1dClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected