Janus icon indicating copy to clipboard operation
Janus copied to clipboard

是否支持传入多张图片?

Open fggggg7142 opened this issue 11 months ago • 3 comments

传2以及2张以上图片报错: Traceback (most recent call last): File "/home/wanghui/daiteng01/deepseek/main.py", line 104, in prepare_inputs = vl_chat_processor( File "/home/wanghui/daiteng01/deepseek/Janus-main/janus/models/processing_vlm.py", line 353, in call prepare = self.batchify([prepare]) File "/home/wanghui/daiteng01/deepseek/Janus-main/janus/models/processing_vlm.py", line 403, in batchify batched_pixel_values[i, :n_image] = prepare.pixel_values RuntimeError: The expanded size of the tensor (1) must match the existing size (2) at non-singleton dimension 0. Target sizes: [1, 3, 384, 384]. Tensor sizes: [2, 3, 384, 384]

fggggg7142 avatar Feb 14 '25 04:02 fggggg7142

我也遇到了相同的问题

wanmei002 avatar Mar 04 '25 03:03 wanmei002

同样的问题 File /jupyter_data/Janus/janus/models/processing_vlm.py:403, in VLChatProcessor.batchify(self, prepare_list) 400 batched_images_seq_mask[i, -seq_len:] = input_ids == self.image_id 402 if n_image > 0: --> 403 batched_pixel_values[i, :n_image] = prepare.pixel_values 404 for j, n_image_tokens in enumerate(prepare.num_image_tokens): 405 batched_images_emb_mask[i, j, :n_image_tokens] = True

RuntimeError: The expanded size of the tensor (1) must match the existing size (40) at non-singleton dimension 0. Target sizes: [1, 3, 384, 384]. Tensor sizes: [40, 3, 384, 384]

hzhj66 avatar Mar 04 '25 06:03 hzhj66

You can try adding the same number of <image_placeholder> as images in User's content.

HangyuRan avatar Mar 30 '25 16:03 HangyuRan