ValueError: Target size (torch.Size([8, 5])) must be the same as input size (torch.Size([8, 6]))
Hi I run zhe code in my servers following the steps. And I met the error as follows:
4/01/2020 01:25:10 - INFO - root - ***** Running training *****
04/01/2020 01:25:10 - INFO - root - Num examples = 122532
04/01/2020 01:25:10 - INFO - root - Num Epochs = 6
04/01/2020 01:25:10 - INFO - root - Total train batch size (w. parallel, distributed & accumulation) = 8
04/01/2020 01:25:10 - INFO - root - Gradient Accumulation steps = 1
04/01/2020 01:25:10 - INFO - root - Total optimization steps = 91902
04/01/2020 01:25:22 - INFO - root - Epoch 1/6
Traceback (most recent call last):
File "run_bert.py", line 228, in
I think it was wrong that I do something. But I do not know why? Hope to get your help!
Thank you very much!
Same error for me but with [11, 5]... it looks like it cant handle if you dont have exactly 6 labels?
Please check your train.csv. Number of labels should exactly be same as specified in xlnet_processor.py and bert_processor.py. Also remove all cached files and .pkl files in dataset directory. Re-run bert or xlnet and your issue should be resolved.