Hello Everyone,
I am new to the ML domain. I was trying to attempt the sentiment analysis using the IMDB dataset. I have used Embedding + Padding + LSTM + Unpacking + 3 Linear Layers → Output (Batch_Size , Classes(my case 0,1)). Using cross entropy loss  & adam as the optimizer.
Observations : 1) On an average it is taking about 6 mins to run an Epoch
2) Loss does not drop significantly
Please find the model & train loader for reference
class SentiClassify_Model(nn.Module):
def init(self,vocabLen,dims,hidden_size,seqLengths,output_size=2):
super().__init__()

#output_size =  2

self.hidden_size = hidden_size

self.seqLengths = seqLengths

self.embed = nn.Embedding(vocabLen,dims)

self.lstm_cell = nn.LSTM(input_size=dims,hidden_size=hidden_size)

self.lf = nn.Linear(max(seqLengths)*hidden_size,(max(seqLengths)*hidden_size)//2)

self.lf1 = nn.Linear((max(seqLengths)*hidden_size)//2,64)

self.lf2 = nn.Linear(64,output_size)

#self.sf_max = nn.Softmax(dim=1)

def forward(self,input,hidden,verbose=False):
embeds = self.embed(input)

packedSeq = pack_padded_sequence(embeds.permute(1,0,2),self.seqLengths,batch_first=True,enforce_sorted=False)

output,hidden = self.lstm_cell(packedSeq,hidden)

outputt, input_sizes = pad_packed_sequence(output, batch_first=True)

reshaped_out = outputt.reshape(outputt.size()[0],outputt.size()[1]*outputt.size()[2])

lin_output = self.lf(reshaped_out)

lin_output1 = self.lf1(lin_output)

lin_output2 = self.lf2(lin_output1)

return lin_output2

if verbose:

  print("input shape",input.shape)

  print('embed shape',embeds.shape)

  print("Rehaped output",reshaped_out.size())

  print("After Fully conn layer :",lin_output.size())

def init_hiddenlayer(self,batch_size,device=‘cpu’):
return (torch.zeros(1,batch_size,self.hidden_size,device=device),torch.zeros(1,batch_size,self.hidden_size,device=device))

##########################################################################
def _trainLoader(model=None,dataloader=None,vocabList = None,optimm =None,loss_func=None,epochs=1,device=‘cpu’):

Hyperparameters
dims = 10
hidden_size = 20
loss_per_epoch,train_accuracy,test_accuracy = 0,None,None

Batch Optimization
for i in range(epochs):
cummLoss = 0

for ind,data in enumerate(dataloader):

  wordInput,seqLengths,targets = data["Vocab"].permute(1,0),data["Seqlen"],data["Senti"]

  modObj = model(len(vocabList),dims,hidden_size,seqLengths).to(device)

  hidden = modObj.init_hiddenlayer(wordInput.size()[-1],device=device)

  source = modObj(wordInput,hidden)

  if optimm==None:

    optimm = optim.Adam(modObj.parameters(),lr=0.005)

  loss = lossFn(source,targets)

  loss.backward(retain_graph=True)

  optimm.zero_grad()

  optimm.step()

  cummLoss+=loss.item()*source.size()[0] ## Cumulative loss per batch

train_accuracy = computeAccuracy(targets,source)

loss_per_epoch = cummLoss/5000

print("Loss per Epoch : {} , Training Accuracy : {}".format(loss_per_epoch,train_accuracy))

Kindly review and let me know how I can improve the model & training
Thanks in Advance