Experts, What’s the reason for that?
Could you check the input shapes of all tensors that you are passing to your criterion?
Apparently some of them are empty. However, the error seems to point to the
Are you using weighted cross entropy or are you passing the
weight manually to the loss calculation?
Hi Patrick, Im using transformers to finetune an input sequence of dialogues. I get the same error, but how would I check the input shapes of the tensors ?
You could print the shapes via:
output = model(input) print(output.shape) print(target.shape) loss = criterion(output, target)
If you are seeing the same error message, the
target tensor might be empty.
Feel free to post your training code, so that we can have a look, if you get stuck.