(self, teacher_model, loss_type, mean_prob=0, *args, **kwargs)
| 25 | |
| 26 | class KDTrainer(Trainer): |
| 27 | def __init__(self, teacher_model, loss_type, mean_prob=0, *args, **kwargs): |
| 28 | super().__init__(*args, **kwargs) |
| 29 | # self.tlsd = tsld_loss |
| 30 | self.loss_fct_none = torch.nn.CrossEntropyLoss(reduction="none") |
| 31 | self.tmp = 1 |
| 32 | self.teacher_model = teacher_model |
| 33 | # self.reverse_loss = reverse_loss |
| 34 | self.loss_type = loss_type |
| 35 | self.mean_prob = mean_prob |
| 36 | self.ce_loss_none = CrossEntropyLoss(reduction="none") |
| 37 | |
| 38 | def cakld_loss(self, labels, student_logits, teacher_logits, beta_prob): |
| 39 | mask = (labels != -100) |
nothing calls this directly
no outgoing calls
no test coverage detected