(self, style_dim, d_hid, nlayers, max_dur=50, dropout=0.1)
| 90 | |
| 91 | class 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) |
nothing calls this directly
no test coverage detected