I advise you to run the tutorial code first without modification and be sure that it works.
Then you make one change at a time and re-run the code so that you could weight the impact of each move otherwise it’ll be difficult to debug.
However, as your accuracy is good, I suspect your valid loss not being correctly averaged.
Hope it helps.