You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in binary_cross_entropy_with_logits(input, target, weight, size_average, reduce, reduction, pos_weight)
2122
2123 if not (target.size() == input.size()):
-> 2124 raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
2125
2126 return torch.binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction_enum)
ValueError: Target size (torch.Size([10])) must be the same as input size (torch.Size([10, 6]))_
For my understanding it has to do something with the args.label-argument.
Can you tell me how I set the labels for this argument right?
I have 6 Labels in my dataset (0,1,2,3,4,5).
I tried running while setting the args-labels-argument as a list ([0,1,2,3,4,5]).
I also tried a string ("0,1,2,3,4,5"). In that case the input size was in shape of (torch.Size([10, 1])
Thank you for response.
The text was updated successfully, but these errors were encountered:
Check your config.ini file and make sure each label is entered properly and is spaced out with commas, essentially make sure the labels are in the exact same way it's written in the config.ini file available in the examples folder in the repo
Another error occurs while running DocumentBertLSTM:
_ValueError Traceback (most recent call last)
in ()
7
8 model = BertForDocumentClassification(args=args)
----> 9 model.fit((train_documents, train_labels), (dev_documents,dev_labels))
3 frames
/usr/local/lib/python3.7/dist-packages/bert_document_classification/document_bert.py in fit(self, train, dev)
187
188 batch_correct_output = correct_output[i:i + self.args['batch_size']].to(device=self.args['device'])
--> 189 loss = self.loss_function(batch_predictions, batch_correct_output)
190 epoch_loss += float(loss.item())
191 #self.log.info(batch_predictions)
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/loss.py in forward(self, input, target)
599 self.weight,
600 pos_weight=self.pos_weight,
--> 601 reduction=self.reduction)
602
603
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in binary_cross_entropy_with_logits(input, target, weight, size_average, reduce, reduction, pos_weight)
2122
2123 if not (target.size() == input.size()):
-> 2124 raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
2125
2126 return torch.binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction_enum)
ValueError: Target size (torch.Size([10])) must be the same as input size (torch.Size([10, 6]))_
For my understanding it has to do something with the args.label-argument.
Can you tell me how I set the labels for this argument right?
I have 6 Labels in my dataset (0,1,2,3,4,5).
I tried running while setting the args-labels-argument as a list ([0,1,2,3,4,5]).
I also tried a string ("0,1,2,3,4,5"). In that case the input size was in shape of (torch.Size([10, 1])
Thank you for response.
The text was updated successfully, but these errors were encountered: