Not sure if this is the best place to post!
I’ve worked with this tut for a couple hours and I found the following bugs:

The tutorial below contains a broken link under “View on GitHub”.
The collate_fn=generate_batch is broken as torch.nn.utils.rnn.pad_sequence swaps the dimensions of data, yielding batches where the 0th element is full of <sos> tokens etc. The correct way would be to use batch_first=True in pad_sequence.

Hope it helps!