Validation loss increasing in pytorch but not in keras

I have been working on pretrained resnet50 in Keras. When I wrote the same code in PyTorch (same hyperparameters and layers), the validation loss keeps increasing or decreasing by a very small amount. The training loss curve decreases pretty well but something fishy is happening in Keras.
Any help would be appreciated.
Here is the link to both of my codes