Thanks. I did something that may sound stupid.
I removed data.cuda() from batchify() and added
data = data.cuda()
target = target.cuda()
in get_batch().
It seems to be running now, but I wonder if this is a quick (and correct) fix.