[data] fix kimi vl template (#8015)

This commit is contained in:
hoshi-hiyouga 2025-05-11 20:45:19 +08:00 committed by GitHub
parent cef3a0b2e2
commit 845af89ea4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -655,8 +655,10 @@ class KimiVLPlugin(BasePlugin):
self._validate_messages(messages, images, videos, audios) self._validate_messages(messages, images, videos, audios)
if self.expand_mm_tokens: if self.expand_mm_tokens:
mm_inputs = self._get_mm_inputs(images, videos, audios, processor) mm_inputs = self._get_mm_inputs(images, videos, audios, processor)
image_grid_hws = mm_inputs.get("image_grid_hws", []) image_grid_hws = mm_inputs.get("image_grid_hws", [])
else:
image_grid_hws = [None] * len(images)
num_image_tokens = 0 num_image_tokens = 0
image_processor: BaseImageProcessor = getattr(processor, "image_processor") image_processor: BaseImageProcessor = getattr(processor, "image_processor")
merge_length = math.prod(image_processor.merge_kernel_size) merge_length = math.prod(image_processor.merge_kernel_size)