[Bugfix] V1: fix allowed_token_ids_mask aliasing in InputBatch.swap_states (#48419)

Signed-off-by: Rui Zhu <rui.zhu.rz399@yale.edu>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Rui Zhu
2026-09-25 23:23:11 +00:00
committed by GitHub
co-authored by Claude
parent b040321b33
commit 974cb65155
2 changed files with 56 additions and 6 deletions
+2 -6
View File
@@ -688,12 +688,8 @@ class InputBatch:
swap_dict_values(self.bad_words_token_ids, i1, i2)
if self.allowed_token_ids_mask_cpu_tensor is not None:
(
self.allowed_token_ids_mask_cpu_tensor[i1],
self.allowed_token_ids_mask_cpu_tensor[i2],
) = (
self.allowed_token_ids_mask_cpu_tensor[i2],
self.allowed_token_ids_mask_cpu_tensor[i1],
self.allowed_token_ids_mask_cpu_tensor[[i1, i2]] = (
self.allowed_token_ids_mask_cpu_tensor[[i2, i1]]
)
def _get_active_token_count(self, req_index: int) -> int: