Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/tiny_llm_ref/kv_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ def get_seq_len(data):
)
for b in range(B):
if data[b] is None:
# for some reasons we need to do this, otherwise it will cause wrong output?
# maybe precision issues?
masks[b, :, :] = causal_mask(mask_length, seq_len, dtype=key.dtype)
continue
key, value, S, mask = data[b]
keys[b, :, seq_len - S : seq_len, :] = key
Expand Down
2 changes: 1 addition & 1 deletion tests_refsol/test_week_2_day_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_task_2_batching_kv_cache():
expected_mask = mx.array(
[
[[[-mx.inf, 0.0, 0.0, -mx.inf], [-mx.inf, 0.0, 0.0, 0.0]]],
[[[0.0, 0.0, 0.0, -mx.inf], [0.0, 0.0, 0.0, 0.0]]],
[[[-mx.inf, -mx.inf, -mx.inf, -mx.inf], [-mx.inf, -mx.inf, -mx.inf, -mx.inf]]],
[[[0.0, 0.0, 0.0, -mx.inf], [0.0, 0.0, 0.0, 0.0]]],
],
dtype=mx.float32,
Expand Down
Loading