forked from SforAiDl/Neural-Voice-Cloning-With-Few-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEncoder.py
executable file
·34 lines (26 loc) · 959 Bytes
/
Encoder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
import torch
import torch.nn as nn
from torch.autograd import Variable
import librosa
import torch.nn.functional as F
from Modules.SpectralProcessing import SpectralProcessing
from Modules.TemporalProcessing import TemporalProcessing
from Modules.CloningSamplesAttention import CloningSamplesAttention
class Encoder(nn.Module):
global batch_size
global N_samples
def __init__(self):
super(Encoder, self).__init__()
self.spectral_layer = SpectralProcessing(80)
self.temporal_layer = TemporalProcessing()
self.cloning_attention_layer = CloningSamplesAttention()
def forward(self, x):
#print(x)
x = self.spectral_layer(x)
x = self.temporal_layer(x)
x = self.cloning_attention_layer(x)
print(x.size())
return x
#def Temp_Masking(x):
#Create function for temporal masking. Use librosa.decompose.hpss. Split and concatinate dimensions to make it 2D.