mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
misc
This commit is contained in:
parent
0ea7c24228
commit
9960917b6a
1 changed files with 1 additions and 1 deletions
|
|
@ -79,7 +79,7 @@ def compute_prefix_matching(shift_logits, shift_labels, valid_masks):
|
|||
def compute_entropy(shift_logits, shift_labels, valid_masks):
|
||||
indices = torch.where(valid_masks)
|
||||
logits = shift_logits[indices]
|
||||
probs = torch.softmax(torch.tensor(logits), dim=-1)
|
||||
probs = torch.softmax(logits, dim=-1)
|
||||
entropy = -torch.sum(probs * torch.log(probs), dim=-1)
|
||||
return {"entropy": entropy.mean().item()}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue