Coerce token ids to int in build_fl2va_presentation
This commit is contained in:
parent
4add435bf9
commit
428c83d1d8
1 changed files with 3 additions and 2 deletions
|
|
@ -462,15 +462,16 @@ def build_fl2va_presentation(
|
||||||
for tok, kind in entries:
|
for tok, kind in entries:
|
||||||
if kind == "image":
|
if kind == "image":
|
||||||
flatten, grid, merged, deepstack, size = vision_outputs[vision_index]
|
flatten, grid, merged, deepstack, size = vision_outputs[vision_index]
|
||||||
|
size = int(size)
|
||||||
start = len(token_ids)
|
start = len(token_ids)
|
||||||
token_ids.extend([0] * size) # placeholder ids, overwritten by the merged rows
|
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}})
|
embeds_info.append({"type": "image", "index": start, "size": size, "extra": {"grid": grid, "deepstack": deepstack, "merged": merged}})
|
||||||
vision_index += 1
|
vision_index += 1
|
||||||
else:
|
else:
|
||||||
token_ids.append(tok)
|
token_ids.append(int(tok))
|
||||||
|
|
||||||
seq_len = len(token_ids)
|
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
|
# Build the Qwen hidden-state input: scaled token embeds, with the merged vision
|
||||||
# rows spliced over the pad positions.
|
# rows spliced over the pad positions.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue