onnx improvement

This commit is contained in:
w-okada 2023-09-06 08:21:12 +09:00
parent 80a5ba91b8
commit 8e822c16e3
6 changed files with 18 additions and 13 deletions

View File

@ -63,7 +63,7 @@ class SynthesizerTrnMs256NSFsid_ONNX(nn.Module):
m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
z = self.flow(z_p, x_mask, g=g, reverse=True)
o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], nsff0, g=g, convert_length=convert_length)
return o, x_mask, (z, z_p, m_p, logs_p)
# o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], nsff0, g=g, convert_length=convert_length)
o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o

View File

@ -62,5 +62,6 @@ class SynthesizerTrnMs256NSFsid_nono_ONNX(nn.Module):
m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
z = self.flow(z_p, x_mask, g=g, reverse=True)
o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], g=g, convert_length=convert_length)
return o, x_mask, (z, z_p, m_p, logs_p)
o = self.dec((z * x_mask)[:, :, :max_len], g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o

View File

@ -67,4 +67,4 @@ class SynthesizerTrnMs768NSFsid_ONNX(nn.Module):
# o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], nsff0, g=g, convert_length=convert_length)
o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o
return o

View File

@ -86,5 +86,6 @@ class SynthesizerTrnMs768NSFsid_nono_ONNX(nn.Module):
m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
z = self.flow(z_p, x_mask, g=g, reverse=True)
o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], g=g, convert_length=convert_length)
return o, x_mask, (z, z_p, m_p, logs_p)
o = self.dec((z * x_mask)[:, :, :max_len], g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o

View File

@ -65,5 +65,7 @@ class SynthesizerTrnMsNSFsidNono_webui_ONNX(nn.Module):
m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
z = self.flow(z_p, x_mask, g=g, reverse=True)
o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], g=g, convert_length=convert_length)
return o, x_mask, (z, z_p, m_p, logs_p)
o = self.dec((z * x_mask)[:, :, :max_len], g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o

View File

@ -66,6 +66,7 @@ class SynthesizerTrnMsNSFsid_webui_ONNX(nn.Module):
m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
z = self.flow(z_p, x_mask, g=g, reverse=True)
o = self.dec.infer_realtime((z * x_mask)[:, :, :max_len], nsff0, g=g, convert_length=convert_length)
return o, x_mask, (z, z_p, m_p, logs_p)
o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
o = torch.clip(o[0, 0], -1.0, 1.0)
return o