Update cross_entropy_loss.py

This commit is contained in:
Daniel Han 2024-10-23 22:18:24 -07:00
commit a048a791f4

View file

@ -373,9 +373,9 @@ def fast_cross_entropy_loss(
logit_softcapping,
logit_scaling,
)
print(n_items)
if n_items is None:
n_items = torch.count_nonzero(labels != -100)
print(n_items)
return loss.sum() / n_items
pass