No offense, but don’t just post badly formatted and not documented code, expecting others to help.
Having said that, you first want to get a simplified version training properly. You don’t immediately need attention, and I’ve never seen just an complicated code for just the decoder.
Start with something working – there are good Seq2Seq PyTorch tutorials – and extend them as needed.