As the error message explains, the target tensor for nn.CrossEntropyLoss should be a LongTensor, while apparently a FloatTensor is passed.
The custom Dataset looks correct, so I assume the target is either generated in another code snippet or transformed after being returned by the Dataset.__getitem__.