16/29
Part 4 of 6 · Top-pLearn and do

Put each kept score back at its own token id

Top-p works on sorted probabilities, but the model's token ids aren't sorted.

print(keep_top_p(by_id, 0.9).softmax(dim=-1).round(decimals=3))
Predict

The result comes back in id order: bed, floor, mat, moon, roof, sofa. Which entries are not 0?

Pick one to see what it prints.
Pick an answer above to see the rest