fast-bert icon indicating copy to clipboard operation
fast-bert copied to clipboard

ValueError: Target size (torch.Size([9, 4])) must be the same as input size (torch.Size([12, 4]))

Open usmansarwar23 opened this issue 4 years ago • 2 comments

I am doing multi-label classification. Getting this error !

usmansarwar23 avatar May 07 '20 01:05 usmansarwar23

There's not enough information here to pursue this.

aaronbriel avatar May 08 '20 18:05 aaronbriel

that is because ur sample size can not evenly divide the batch size, try to set drop_last=True, for your Pytorch Dataloader here: https://github.com/kaushaltrivedi/fast-bert/blob/master/fast_bert/data_cls.py#L460 for all train , validation and test.

YanLiang1102 avatar Dec 08 '20 01:12 YanLiang1102