mirror of
https://github.com/deepseek-ai/Janus.git
synced 2026-11-05 00:57:18 +00:00
[GH-ISSUE #54] 怎么进行多图联合推理 #44
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/Janus#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LiLiLiam on GitHub (Jan 28, 2025).
Original GitHub issue: https://github.com/deepseek-ai/Janus/issues/54
我需要在一个question中对多张图进行联合推理,以下是我的部分代码:
content_images = []
for idx in range(len(image_files)):
# content.append({"type": "image", "image": image_files[idx]})
content_images.append("data:image,{}".format(image_to_base64(image_files[idx], max_size=1024)))
目前会提示问题:
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]
要如何改进我的代码,使其可以实现多图联合推理
@liziming5353 commented on GitHub (Jan 28, 2025):
同问,请问您解决了吗
@xwgnick commented on GitHub (Feb 6, 2025):
解决了,记得用多个"<image_placeholder>, 有几张图就用几个,like:
conversation = [ { "role": "<|User|>", "content": f"<image_placeholder>\n<image_placeholder>\n{question}", "images": ["./test_images/test_1.jpg", "./test_images/test_2.jpg"], }, {"role": "<|Assistant|>", "content": ""}, ]@wuming027 commented on GitHub (Feb 12, 2025):
遍历选定的图像文件并加载图像
我这样的话会报错,请问应该如何解决