pet icon indicating copy to clipboard operation
pet copied to clipboard

There is no softmax

Open bookpen opened this issue 1 year ago • 0 comments

I find there is no softmax function when I should get the distribution of prediction.


wrapper.py def mlm_train_step(self, labeled_batch: Dict[str, torch.Tensor], unlabeled_batch: Optional[Dict[str, torch.Tensor]] = None, lm_training: bool = False, alpha: float = 0, **_) -> torch.Tensor: """Perform a MLM training step."""

inputs = self.generate_default_inputs(labeled_batch)
mlm_labels, labels = labeled_batch['mlm_labels'], labeled_batch['labels']

outputs = self.model(**inputs)
prediction_scores = self.preprocessor.pvp.convert_mlm_logits_to_cls_logits(mlm_labels, outputs[0])
loss = nn.CrossEntropyLoss()(prediction_scores.view(-1, len(self.config.label_list)), labels.view(-1))

the prediction_scores is not applied to the softmax

bookpen avatar Aug 12 '23 03:08 bookpen