Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions renderers/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,15 @@ def _build_qwen_vl_features(

image_items = mm_data.mm_items.get("image") or []
if image_items:
pixel_values = torch.cat([it["pixel_values"] for it in image_items], dim=0)
image_grid_thw = torch.cat([it["image_grid_thw"] for it in image_items], dim=0)
# mm_items now ship numpy arrays (the renderer is torch-free);
# convert at this vLLM-glue boundary where torch is already a
# hard dependency.
pixel_values = torch.cat(
[torch.as_tensor(it["pixel_values"]) for it in image_items], dim=0
)
image_grid_thw = torch.cat(
[torch.as_tensor(it["image_grid_thw"]) for it in image_items], dim=0
)
hf_inputs = BatchFeature(
data={"pixel_values": pixel_values, "image_grid_thw": image_grid_thw}
)
Expand Down
2 changes: 1 addition & 1 deletion renderers/kimi_k25.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def _process_image(self, part: dict[str, Any]):
img_proc = proc.image_processor
# Kimi's vision processor takes a media-dict shape, not raw PIL.
media_item = {"type": "image", "image": pil}
out = img_proc.preprocess([media_item], return_tensors="pt")
out = img_proc.preprocess([media_item], return_tensors="np")
# Patch count via the processor's own calculator (matches the
# model's per-patch attention count); kept for debugging.
num_patches = int(img_proc.media_tokens_calculator(media_item))
Expand Down
2 changes: 1 addition & 1 deletion renderers/qwen35.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def _process_image(self, part: dict[str, Any]):
out, num_image_tokens = cached
return pil, out, num_image_tokens, h
proc = self._get_processor()
out = proc.image_processor(images=[pil], return_tensors="pt")
out = proc.image_processor(images=[pil], return_tensors="np")
grid_thw = out["image_grid_thw"][0]
merge_size = proc.image_processor.merge_size
num_image_tokens = int(grid_thw.prod()) // (merge_size * merge_size)
Expand Down
2 changes: 1 addition & 1 deletion renderers/qwen3_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def _process_image(self, part: dict[str, Any]):
out, num_image_tokens = cached
return pil, out, num_image_tokens, h
proc = self._get_processor()
out = proc.image_processor(images=[pil], return_tensors="pt")
out = proc.image_processor(images=[pil], return_tensors="np")
grid_thw = out["image_grid_thw"][0]
merge_size = proc.image_processor.merge_size
num_image_tokens = int(grid_thw.prod()) // (merge_size * merge_size)
Expand Down
Loading