[Bug] Fix out-of-range token id crashing tp=1 VocabParallelEmbedding (#27482)

This commit is contained in:
Liangsheng Yin
2026-06-06 23:00:17 -07:00
committed by GitHub
parent 80eee2d92c
commit 0ce3db3c0a
4 changed files with 27 additions and 7 deletions
@@ -863,9 +863,11 @@ class TestRadixCache(unittest.TestCase):
torch_allocated_before = torch.cuda.memory_allocated()
# build dataset with common prefix
common_prefix = [random.randint(1, vocab_size) for _ in range(base_prefix_len)]
common_prefix = [
random.randint(1, vocab_size - 1) for _ in range(base_prefix_len)
]
for _ in range(num_seqs):
suffix = [random.randint(1, vocab_size) for _ in range(suffix_len)]
suffix = [random.randint(1, vocab_size - 1) for _ in range(suffix_len)]
seq = common_prefix + suffix
keys.append(seq)
values.append(torch.zeros(len(seq), device="cuda", dtype=torch.int32))