MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / __init__

Method __init__

kokoro/modules.py:92–107  ·  view source on GitHub ↗
(self, style_dim, d_hid, nlayers, max_dur=50, dropout=0.1)

Source from the content-addressed store, hash-verified

90
91class ProsodyPredictor(nn.Module):
92 def __init__(self, style_dim, d_hid, nlayers, max_dur=50, dropout=0.1):
93 super().__init__()
94 self.text_encoder = DurationEncoder(sty_dim=style_dim, d_model=d_hid,nlayers=nlayers, dropout=dropout)
95 self.lstm = nn.LSTM(d_hid + style_dim, d_hid // 2, 1, batch_first=True, bidirectional=True)
96 self.duration_proj = LinearNorm(d_hid, max_dur)
97 self.shared = nn.LSTM(d_hid + style_dim, d_hid // 2, 1, batch_first=True, bidirectional=True)
98 self.F0 = nn.ModuleList()
99 self.F0.append(AdainResBlk1d(d_hid, d_hid, style_dim, dropout_p=dropout))
100 self.F0.append(AdainResBlk1d(d_hid, d_hid // 2, style_dim, upsample=True, dropout_p=dropout))
101 self.F0.append(AdainResBlk1d(d_hid // 2, d_hid // 2, style_dim, dropout_p=dropout))
102 self.N = nn.ModuleList()
103 self.N.append(AdainResBlk1d(d_hid, d_hid, style_dim, dropout_p=dropout))
104 self.N.append(AdainResBlk1d(d_hid, d_hid // 2, style_dim, upsample=True, dropout_p=dropout))
105 self.N.append(AdainResBlk1d(d_hid // 2, d_hid // 2, style_dim, dropout_p=dropout))
106 self.F0_proj = nn.Conv1d(d_hid // 2, 1, 1, 1, 0)
107 self.N_proj = nn.Conv1d(d_hid // 2, 1, 1, 1, 0)
108
109 def forward(self, texts, style, text_lengths, alignment, m):
110 d = self.text_encoder(texts, style, text_lengths, m)

Callers

nothing calls this directly

Calls 4

DurationEncoderClass · 0.85
LinearNormClass · 0.85
AdainResBlk1dClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected