MCPcopy Create free account
hub / github.com/MYZY-AI/Muyan-TTS / forward

Method forward

sovits/models.py:239–262  ·  view source on GitHub ↗
(self, y, y_lengths, text, text_lengths, ge, speed=1,test=None)

Source from the content-addressed store, hash-verified

237 self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
238
239 def forward(self, y, y_lengths, text, text_lengths, ge, speed=1,test=None):
240 y_mask = torch.unsqueeze(commons.sequence_mask(y_lengths, y.size(2)), 1).to(
241 y.dtype
242 )
243
244 y = self.ssl_proj(y * y_mask) * y_mask
245
246 y = self.encoder_ssl(y * y_mask, y_mask)
247
248 text_mask = torch.unsqueeze(
249 commons.sequence_mask(text_lengths, text.size(1)), 1
250 ).to(y.dtype)
251 if test == 1:
252 text[:, :] = 0
253 text = self.text_embedding(text).transpose(1, 2)
254 text = self.encoder_text(text * text_mask, text_mask)
255 y = self.mrte(y, y_mask, text, text_mask, ge)
256 y = self.encoder2(y * y_mask, y_mask)
257 if(speed!=1):
258 y = F.interpolate(y, size=int(y.shape[-1] / speed)+1, mode="linear")
259 y_mask = F.interpolate(y_mask, size=y.shape[-1], mode="nearest")
260 stats = self.proj(y) * y_mask
261 m, logs = torch.split(stats, self.out_channels, dim=1)
262 return y, m, logs, y_mask
263
264 def extract_latent(self, x):
265 x = self.ssl_proj(x)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected