My model is given by:
self.flatten = nn.Flatten()
self.linear_LeakyReLU_stack = nn.Sequential(
def forward(self, x):
x = self.flatten(x)
out = self.linear_LeakyReLU_stack(x)
During the training process, the soft cross entropy loss exhibits huge spikes after seemingly having made good progress:
What could be the reason for this behavior? Is there any way I could make the training process more stable?
A hint, anyone? I suspect there may be a flaw in how I set up the model, but I don’t see it.
I think your model is overfitting. What’s your validation phase behavior?
The blue line in the plot is the average training loss during each epoch, and the orange line is the average validation loss for each epoch. Validation does not use the dropout layers while training does use them. Actually, since training and validation loss are so close together at all times, I don’t think overfitting is an issue. There must be something else going on?
My bad. I didn’t see the legends. Did you experiment with learning rate decay? Maybe after some epochs, your lr is too high to find optimal minima.
I am using
optimizer = torch.optim.Adam(mymodel.parameters(), lr=0.003). Good point, I’ll try to experiment with different learning rates, thanks for the suggestion.
Learning Rate Schedular. Should help with convergence.