mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
tiny fix to comment
Update engine.py with correct error message on assert
This commit is contained in:
commit
ad39db5a23
|
|
@ -109,7 +109,7 @@ class KVCache:
|
||||||
for ix, (dim1, dim2) in enumerate(zip(self.kv_shape, other.kv_shape)):
|
for ix, (dim1, dim2) in enumerate(zip(self.kv_shape, other.kv_shape)):
|
||||||
if ix in [0, 1, 3, 5]:
|
if ix in [0, 1, 3, 5]:
|
||||||
# num_layers, batch_size, num_heads, head_dim must match
|
# num_layers, batch_size, num_heads, head_dim must match
|
||||||
assert dim1 == dim2, f"Batch dim mismatch: {dim1} != {dim2}"
|
assert dim1 == dim2, f"Dim {ix} mismatch: {dim1} != {dim2}"
|
||||||
elif ix == 2:
|
elif ix == 2:
|
||||||
# batch_size can be expanded
|
# batch_size can be expanded
|
||||||
assert dim1 == dim2 or dim2 == 1, f"Batch dim mismatch: {dim1} != {dim2}"
|
assert dim1 == dim2 or dim2 == 1, f"Batch dim mismatch: {dim1} != {dim2}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user