huggingface / huggingface/diffusers

HELP, can I do img2img on multi imgs at the same time?

オープン
#7,066 コメント 8 件 リアクション 0 件 担当者 1 名 @yiyixuxu が担当を希望しています GitHub で見る
stale
主要言語
Python
スター
34.5k
フォーク
7.3k
平均マージ
3日 3時間
マージ済み PR(30日)
91

説明

In my case, I need to do img2img on multiple images, I saw the parameter "image" can be a list of PIL.image.iamge but when I used a list of images as input, I got an error like below.

> File "/mnt/disk1/1/code/ip-adapter/infer-face-diffusers-lcm-upscaleM1.py", line 107, in ip
image_hires = pipes_img2img[i](ip_adapter_image=image, image=imgs_resize, prompt=prompt, negative_prompt=n_prompt_default, num_inference_steps=steps, guidance_scale=gs_scale, strength=strength).images
File "/home/1/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/1/.local/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py", line 1083, in __call__
noise_pred = self.unet(
File "/home/1/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/1/.local/lib/python3.10/site-packages/diffusers/models/unets/unet_2d_condition.py", line 1121, in forward
sample, res_samples = downsample_block(
File "/home/1/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/1/.local/lib/python3.10/site-packages/diffusers/models/unets/unet_2d_blocks.py", line 1199, in forward
hidden_states = attn(
File "/home/1/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/1/.local/lib/python3.10/site-packages/diffusers/models/transformers/transformer_2d.py", line 391, in forward
hidden_states = block(
File "/home/1/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/1/.local/lib/python3.10/site-packages/diffusers/models/attention.py", line 378, in forward
hidden_states = attn_output + hidden_states
RuntimeError: The size of tensor a (43520) must match the size of tensor b (21760) at non-singleton dimension 1

How should I do this correctly? If I can do multi img2img at the same time, that would be great.
HELP, thank you!

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。