Coerce token ids to int in build_fl2va_presentation

This commit is contained in:
Daniel Maddern 2026-08-19 22:51:48 +07:00
parent 4add435bf9
commit 428c83d1d8

View file

@ -462,15 +462,16 @@ def build_fl2va_presentation(
for tok, kind in entries:
if kind == "image":
flatten, grid, merged, deepstack, size = vision_outputs[vision_index]
size = int(size)
start = len(token_ids)
token_ids.extend([0] * size) # placeholder ids, overwritten by the merged rows
embeds_info.append({"type": "image", "index": start, "size": size, "extra": {"grid": grid, "deepstack": deepstack, "merged": merged}})
vision_index += 1
else:
token_ids.append(tok)
token_ids.append(int(tok))
seq_len = len(token_ids)
input_ids = torch.tensor(token_ids, device=device)
input_ids = torch.tensor([int(t) for t in token_ids], dtype=torch.long, device=device)
# Build the Qwen hidden-state input: scaled token embeds, with the merged vision
# rows spliced over the pad positions.