Update modeling_baichuan.py
Browse files- modeling_baichuan.py +0 -7
modeling_baichuan.py
CHANGED
@@ -583,7 +583,6 @@ class BaichuanCharRM(BaichuanPreTrainedModel):
|
|
583 |
hidden_states = transformer_outputs[0]
|
584 |
|
585 |
hidden_states = hidden_states[:, -1, :]
|
586 |
-
# logits = F.sigmoid(self.score(hidden_states)).squeeze()
|
587 |
logits = F.sigmoid(self.score(hidden_states).squeeze())
|
588 |
|
589 |
loss = None
|
@@ -592,10 +591,4 @@ class BaichuanCharRM(BaichuanPreTrainedModel):
|
|
592 |
loss_fct = nn.MSELoss()
|
593 |
loss = loss_fct(logits.view(-1), labels.view(-1)/4)
|
594 |
|
595 |
-
# logits = logits.view(-1, 2)
|
596 |
-
# loss_fct_1 = nn.MSELoss()
|
597 |
-
# loss_fct_2 = nn.LogSoftmax(dim=-1)
|
598 |
-
# loss_1 = loss_fct_1(logits[:,0], labels)
|
599 |
-
# loss_2 = -torch.mean(loss_fct_2(logits)[:,1])
|
600 |
-
# loss = loss_1 + loss_2
|
601 |
return loss, logits
|
|
|
583 |
hidden_states = transformer_outputs[0]
|
584 |
|
585 |
hidden_states = hidden_states[:, -1, :]
|
|
|
586 |
logits = F.sigmoid(self.score(hidden_states).squeeze())
|
587 |
|
588 |
loss = None
|
|
|
591 |
loss_fct = nn.MSELoss()
|
592 |
loss = loss_fct(logits.view(-1), labels.view(-1)/4)
|
593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
return loss, logits
|