F.nll_loss expects the targets as LongTensors containing the class indices, while you are trying to pass a FloatTensor to it as the error message explains.
If your target already contains the necessary class indices, call target = target.long() before passing it to the criterion.