Skip to content

Commit b87adbf

Browse files
MoonRainy21hareeen
authored andcommitted
convert n_items type from torch.Tensor to int
1 parent 37dfb23 commit b87adbf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

unsloth_zoo/training_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def unsloth_train(trainer):
403403
n_items = torch.stack([
404404
torch.count_nonzero(x["labels"][..., 1:] != -100) for x in batches
405405
]).sum()
406+
n_items = int(n_items.item())
406407

407408
# Gradient accumulation
408409
for batch in batches:

0 commit comments

Comments
 (0)