MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / __init__

Method __init__

train/mytrainer.py:27–36  ·  view source on GitHub ↗
(self, teacher_model, loss_type, mean_prob=0, *args, **kwargs)

Source from the content-addressed store, hash-verified

25
26class 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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected