aigc-apps / sd-webui-EasyPhoto

📷 EasyPhoto | Your Smart AI Photo Generator.
Apache License 2.0
4.98k stars 399 forks source link

RuntimeError: The size of tensor a (16) must match the size of tensor b (8) at non-singleton dimension 0 #295

Closed developer-JingHSY closed 11 months ago

developer-JingHSY commented 12 months ago

当我使用 img2video时,报错造成ValueError: There is no face in video. Error running before_process_batch: /home/yaohs/Work/stable-diffusion-webui/extensions/sd-webui-EasyPhoto/scripts/sdwebui.py Traceback (most recent call last): File "/home/yaohs/Work/stable-diffusion-webui/modules/scripts.py", line 627, in before_process_batch script.before_process_batch(p, *script_args, *kwargs) File "/home/yaohs/Work/stable-diffusion-webui/extensions/sd-webui-EasyPhoto/scripts/sdwebui.py", line 282, in before_process_batch AnimateDiffI2VLatent().randomize(p, params) File "/home/yaohs/Work/stable-diffusion-webui/extensions/sd-webui-EasyPhoto/scripts/easyphoto_utils/animatediff_utils.py", line 899, in randomize p.init_latent = p.init_latent reserve_scale + p.rng.next() * (1 - reserve_scale) RuntimeError: The size of tensor a (16) must match the size of tensor b (8) at non-singleton dimension 0

Traceback (most recent call last): File "/home/yaohs/Work/stable-diffusion-webui/extensions/sd-webui-EasyPhoto/scripts/easyphoto_infer.py", line 1868, in easyphoto_video_infer_forward input_image, loop_template_crop_safe_box = call_face_crop_templates( File "/home/yaohs/Work/stable-diffusion-webui/extensions/sd-webui-EasyPhoto/scripts/easyphoto_utils/face_process_utils.py", line 221, in call_face_crop_templates raise ValueError("There is no face in video.") ValueError: There is no face in video.

使用的3090 torch 2.1.0 xformers 0.0.22.post7+cu118 accelerate 0.24.1 opencv-python 4.8.1.78 image

wuziheng commented 11 months ago

这边方便你一起调试一下么? 我不太确定如何复现你的问题,如果你还可以复现你的问题,可以在 p.init_latent = p.init_latent reserve_scale + p.rng.next() (1 - reserve_scale) 这一行代码前,打印所有的tensor的shape,具体可以试试加上 print( p.init_latent.shape) m = p.rng.next() print( m.shape) print(type(reserve_scale)) 看一下,而且似乎有2个bug 第二个bug是生成图片没有检测到脸,这个已经在 https://github.com/aigc-apps/sd-webui-EasyPhoto/pull/298 里面在修了

developer-JingHSY commented 11 months ago

上次参数 video max frames设置的是8,发现当这个值设置成16以上是没有问题的。猜测是不是animatediff context length默认16的原因

   

yhs-personal @.***

 

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年12月4日(星期一) 上午10:05 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [aigc-apps/sd-webui-EasyPhoto] RuntimeError: The size of tensor a (16) must match the size of tensor b (8) at non-singleton dimension 0 (Issue #295)

这边方便你一起调试一下么? 我不太确定如何复现你的问题,如果你还可以复现你的问题,可以在 p.init_latent = p.init_latent reserve_scale + p.rng.next() (1 - reserve_scale) 这一行代码前,打印所有的tensor的shape,具体可以试试加上 print( p.init_latent.shape) m = p.rng.next() print( m.shape) print(type(reserve_scale)) 看一下,而且似乎有2个bug

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bubbliiiing commented 11 months ago

可以拉取最新的代码,已经增加了错误catch。 animatediff对8支持不好。

developer-JingHSY commented 11 months ago

Thanks