Unverified Commit 2ae9c290 authored by GuanLuo's avatar GuanLuo Committed by GitHub
Browse files

fix: remove empty multimodal input to avoid invalid uuid check in vLLM (#6853)


Signed-off-by: default avatarGuan Luo <41310872+GuanLuo@users.noreply.github.com>
parent 19e8a165
......@@ -201,8 +201,19 @@ class MultimodalPDWorkerHandler(BaseWorkerHandler):
)
if image_embeds is not None:
request.embeddings_shape = list(image_embeds.shape)
# prune empty multimodal data, vLLM will expect multi_modal_uuids if the mm items are empty
# i.e. ValueError: multi_modal_data['image'] is empty but multi_modal_uuids['image'] is missing.
for key, value in multi_modal_data.items():
if not isinstance(value, torch.Tensor):
if not value:
del multi_modal_data[key]
else:
# [gluo FIXME] should be mindful to default dict, move this evaluation logic to here
# so that we don't accidentally add empty keys to the dict which causes vLLM misbehavior
logger.debug(
f"Prepared multimodal data size: {len(multi_modal_data[key])}"
)
logger.debug(f"Prepared multimodal data size: {len(multi_modal_data['image'])}")
logger.debug("Multimodal data keys: %s", list(multi_modal_data.keys()))
@staticmethod
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment