예제 #1
0
 def __init__(self):
     super(AudioDecoder, self).__init__()
     self.hc_blocks = nn.ModuleList([
         norm(
             ll.CausalConv1d(args.Cx * 2,
                             args.Cy,
                             1,
                             activation_fn=torch.relu))
     ])
     self.hc_blocks.extend([
         norm(ll.CausalHighwayConv1d(args.Cy, args.Cy, 3, dilation=3**i))
         for i in range(4)
     ])
     self.hc_blocks.extend([
         norm(ll.CausalHighwayConv1d(args.Cy, args.Cy, 3, dilation=1))
         for _ in range(2)
     ])
     self.hc_blocks.extend([
         norm(
             ll.CausalConv1d(args.Cy,
                             args.Cy,
                             1,
                             dilation=1,
                             activation_fn=torch.relu)) for _ in range(3)
     ])
     self.hc_blocks.extend([
         norm(ll.CausalConv1d(args.Cy, args.n_mels, 1, dilation=1))
     ])  # down #filters to dotproduct K, V
예제 #2
0
    def __init__(self,
                 inChannel,
                 outChannel,
                 kernelSize,
                 padding,
                 dilation,
                 activationF=None,
                 weightNorm=False):
        #nn.conv1d(in_channels, out_channels, kernel size, stride, padding,
        #          dilation, ...)
        #
        super(Cv, self).__init__()
        padDic = {
            "same": (kernelSize - 1) * dilation // 2,
            "causal": (kernelSize - 1) * dilation,
            "none": 0
        }
        self.pad = padding.lower()
        self.padValue = padDic[self.pad]
        self.kernelSize = kernelSize
        self.dilation = dilation
        self.convOne = nn.Conv1d(in_channels=inChannel,
                                 out_channels=outChannel,
                                 kernel_size=kernelSize,
                                 stride=1,
                                 padding=self.padValue,
                                 dilation=dilation)
        if weightNorm:
            self.convOne = norm(self.convOne)

        self.activationF = activationF

        self.clear_buffer()
예제 #3
0
 def __init__(self,
              inChannel,
              outChannel,
              kernelSize,
              padding,
              dilation,
              activationF=None,
              weightNorm=False):
     super(Dc, self).__init__()
     padDic = {
         "same": dilation * (kernelSize - 1) // 2,
         "causal": dilation * (kernelSize - 1),
         "none": 0
     }
     self.pad = padding.lower()
     self.padValue = padDic[self.pad]
     self.transposedCv = nn.ConvTranspose1d(in_channels=inChannel,
                                            out_channels=outChannel,
                                            kernel_size=kernelSize,
                                            stride=2,
                                            padding=self.padValue,
                                            dilation=dilation)
     if weightNorm:
         self.convOne = norm(self.convOne)
     self.activationF = activationF
예제 #4
0
 def __init__(self):
     super(TextEncoder, self).__init__()
     self.hc_blocks = nn.ModuleList([
         norm(
             ll.Conv1d(args.Ce,
                       args.Cx * 2,
                       1,
                       padding='same',
                       activation_fn=torch.relu))
     ])  # filter up to split into K, V
     self.hc_blocks.extend([
         norm(
             ll.Conv1d(args.Cx * 2,
                       args.Cx * 2,
                       1,
                       padding='same',
                       activation_fn=None))
     ])
     self.hc_blocks.extend([
         norm(
             ll.HighwayConv1d(args.Cx * 2,
                              args.Cx * 2,
                              3,
                              dilation=3**i,
                              padding='same')) for _ in range(2)
         for i in range(4)
     ])
     self.hc_blocks.extend([
         norm(
             ll.HighwayConv1d(args.Cx * 2,
                              args.Cx * 2,
                              3,
                              dilation=1,
                              padding='same')) for i in range(2)
     ])
     self.hc_blocks.extend([
         norm(
             ll.HighwayConv1d(args.Cx * 2,
                              args.Cx * 2,
                              1,
                              dilation=1,
                              padding='same')) for i in range(2)
     ])
예제 #5
0
 def __init__(self, d_in, d_out, d_hidden):
     super(AudioEncoder, self).__init__()
     self.hc_blocks = nn.ModuleList([
         norm(ll.CausalConv1d(d_in, d_hidden, 1, activation_fn=torch.relu))
     ])
     self.hc_blocks.extend([
         norm(
             ll.CausalConv1d(d_hidden,
                             d_hidden,
                             1,
                             activation_fn=torch.relu)) for _ in range(2)
     ])
     self.hc_blocks.extend([
         norm(ll.CausalHighwayConv1d(
             d_hidden, d_hidden, 3,
             dilation=3**i))  # i is in [[0,1,2,3],[0,1,2,3]]
         for _ in range(2) for i in range(4)
     ])
     self.hc_blocks.extend([
         norm(ll.CausalHighwayConv1d(d_hidden, d_out, 3, dilation=3))
         for i in range(2)
     ])
 def __init__(self):
     super(AudioEncoder, self).__init__()
     self.hc_blocks = nn.ModuleList([
         norm(
             mm.CausalConv1d(args.n_mels,
                             args.Cx,
                             1,
                             activation_fn=torch.relu))
     ])
     self.hc_blocks.extend([
         norm(mm.CausalConv1d(args.Cx, args.Cx, 1,
                              activation_fn=torch.relu)) for _ in range(2)
     ])
     self.hc_blocks.extend([
         norm(mm.CausalHighwayConv1d(
             args.Cx, args.Cx, 3,
             dilation=3**i))  # i is in [[0,1,2,3],[0,1,2,3]]
         for _ in range(2) for i in range(4)
     ])
     self.hc_blocks.extend([
         norm(mm.CausalHighwayConv1d(args.Cx, args.Cx, 3, dilation=3))
         for i in range(2)
     ])
예제 #7
0
파일: model.py 프로젝트: AmisArbel/AdvDCTTS
 def __init__(self):
     super(SSRN, self).__init__()
     self.name = 'SSRN'
     # (N, n_mels, Ty/r) -> (N, Cs, Ty/r)
     self.hc_blocks = nn.ModuleList([
         norm(ll.Conv1d(args.n_mels, args.Cs, 1, activation_fn=torch.relu))
     ])
     self.hc_blocks.extend([
         norm(ll.HighwayConv1d(args.Cs, args.Cs, 3, dilation=3**i))
         for i in range(2)
     ])
     # (N, Cs, Ty/r*2) -> (N, Cs, Ty/r*2)
     self.hc_blocks.extend([
         norm(ll.ConvTranspose1d(args.Cs, args.Cs, 4, stride=2, padding=1))
     ])
     self.hc_blocks.extend([
         norm(ll.HighwayConv1d(args.Cs, args.Cs, 3, dilation=3**i))
         for i in range(2)
     ])
     # (N, Cs, Ty/r*2) -> (N, Cs, Ty/r*4==Ty)
     self.hc_blocks.extend([
         norm(ll.ConvTranspose1d(args.Cs, args.Cs, 4, stride=2, padding=1))
     ])
     self.hc_blocks.extend([
         norm(ll.HighwayConv1d(args.Cs, args.Cs, 3, dilation=3**i))
         for i in range(2)
     ])
     # (N, Cs, Ty) -> (N, Cs*2, Ty)
     self.hc_blocks.extend([norm(ll.Conv1d(args.Cs, args.Cs * 2, 1))])
     self.hc_blocks.extend([
         norm(ll.HighwayConv1d(args.Cs * 2, args.Cs * 2, 3, dilation=1))
         for i in range(2)
     ])
     # (N, Cs*2, Ty) -> (N, n_mags, Ty)
     self.hc_blocks.extend([norm(ll.Conv1d(args.Cs * 2, args.n_mags, 1))])
     self.hc_blocks.extend([
         norm(
             ll.Conv1d(args.n_mags,
                       args.n_mags,
                       1,
                       activation_fn=torch.relu)) for i in range(2)
     ])
     self.hc_blocks.extend([norm(ll.Conv1d(args.n_mags, args.n_mags, 1))])