Thank you for reply. As your suggestion I used 1 mini batch with 500 sample and trained my network. Unfortunately, the loss did not change considerably. My prediction model is as follow:
class RecurrentModel(nn.Module):
def init(self, input_size = args.input_size, hidden_units=256, number_of_outputs=2):
super(RecurrentModel, self).init()
self.hidden = hidden_units
self. input_size = input_size
self. n_outputs = number_of_outputs
self.lstm = nn.LSTM(input_size = self.input_size, hidden_size = self.hidden, num_layers = 2, batch_first=True)
self.linear = nn.Linear (hidden_units, number_of_outputs)
def forward(self, net):
batch_size, seq_length, num_features = list (net.size())
outputs, _ = self.lstm (net)
prediction = self.linear(outputs[0])
return torch.reshape(prediction, (batch_size*seq_length, self.n_outputs))
class AudioModel(nn.Module):
def init(self):
super(AudioModel, self).init()
self.drop = nn.Dropout()
self.conv1 = nn.Conv2d(1, 40, (1,20), padding=(0,9))
self.relu1 = nn.ReLU()
self.pool1 = nn.MaxPool2d((1, 2), (1, 2))
self.conv2 = nn.Conv2d(20, 40, (1,160), padding=(0,80) ) #padding = (0,38)
self.relu2 = nn.ReLU()
self.pool2 = nn.MaxPool2d((1, 10), (1, 10))
def forward(self, audio_frames, conv_filters = 40):
    batch_seq_length, num_features = list (audio_frames.size())
    seq_length = args.seq_length
    batch_size = args.batch_size
    rnn = RecurrentModel ()
    audio_input = torch.reshape(audio_frames, [1, 1, batch_size * seq_length, num_features])
    net = self.drop(audio_input)
    net = self.conv1(net)
    net = self.relu1(net)
    # Subsampling of the signal to 8KhZ.
    net = self.pool1(net)
    net = self.conv2(net)
    net = self.relu2(net)
    net = torch.reshape(net, (1,batch_size * seq_length,
                           num_features // 2, conv_filters)) #(num_features // 3)+37
    net = self.pool2(net)
    net = torch.reshape(net, (batch_size, seq_length,  num_features // 2 * 4)) 
    net = rnn (net)
    return net

batch_size and seq_length are equal to 25 and 1, respectively.