12/26
Part 3 of 4 · The mask, and the cache you returnLearn and do
New tokens sit after the cached ones, so the mask shifts
The causal mask has to change shape too.
print(torch.ones(2, 5, dtype=torch.long).tril(diagonal=3))
print(torch.ones(2, 5, dtype=torch.long).tril())
tril(diagonal=n) keeps the entries where the column minus the row is at most n. What does the first line print?
Pick one to see what it prints.
Pick an answer above to see the rest
One new token on 6 cached. Does the mask hide anything?
Pick an answer above to see the rest