mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-15 00:32:25 +00:00
Merge 02440f670d into 190d9515d0
This commit is contained in:
commit
eee60a0839
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user