This commit is contained in:
Bhaskar 2025-10-15 10:14:22 -07:00 committed by GitHub
commit eee60a0839
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,5 +59,7 @@ def evaluate_bpb(model, batches, steps, token_bytes):
# move both to cpu, calculate bpb and return
total_nats = total_nats.item()
total_bytes = total_bytes.item()
if total_bytes == 0:
return float('inf')
bpb = total_nats / (math.log(2) * total_bytes)
return bpb