I want to add that both keras and pytorch training are the same. But their validation losses are different.
I am pretty sure that general codes are OK. Because I am running this code n another PC, and its working (another dataset). All the versions and libraries are the same in both PCs.