continue-revolution / sd-webui-animatediff

AnimateDiff for AUTOMATIC1111 Stable Diffusion WebUI
Other
3.1k stars 258 forks source link

"AttributeError: 'NoneType' object has no attribute 'mode'" when using video source in img2img tab #248

Closed Gyramuur closed 1 year ago

Gyramuur commented 1 year ago

Is there an existing issue for this?

Have you read FAQ on README?

What happened?

Running updated WebUI and AnimateDiff extension. In the img2img tab, you're supposedly able to use a video as input. However, when I do so and I enable AnimateDiff, it throws a "AttributeError: 'NoneType' object has no attribute 'mode'" error.

Steps to reproduce the problem

  1. Start WebUI.
  2. Go to img2img tab.
  3. Enable AnimateDiff, using default mm_sd_v15_v2 model.
  4. Upload .mp4 to video source subsection of AnimateDiff dropdown within img2img tab.
  5. Enter prompt and hit generate.
  6. Above error occurs.

What should have happened?

AnimateDiff should have used the video file.

Commit where the problem happens

webui: 5ef669de080814067961f28357256e8fe27544f4 (1.6.0) extension: 2f0e68d08028b0440a899c57dcfaf4972a5f0185

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--no-half-vae --opt-split-attention --upcast-sampling --xformers

Console logs

Startup time: 17.5s (prepare environment: 2.7s, import torch: 3.4s, import gradio: 1.0s, setup paths: 0.9s, initialize shared: 0.3s, other imports: 0.7s, setup codeformer: 0.1s, load scripts: 5.5s, create ui: 2.8s, gradio launch: 0.1s).
2023-10-25 13:23:23,994 - AnimateDiff - INFO - AnimateDiff process start.
2023-10-25 13:23:24,002 - AnimateDiff - INFO - You are using tested mm mm_sd_v15_v2.ckpt.
2023-10-25 13:23:24,002 - AnimateDiff - INFO - Loading motion module mm_sd_v15_v2.ckpt from E:\waifu\webui2\new\stable-diffusion-webui\extensions\sd-webui-animatediff\model\mm_sd_v15_v2.ckpt
2023-10-25 13:23:28,161 - AnimateDiff - WARNING - Missing keys <All keys matched successfully>
2023-10-25 13:23:29,187 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet middle block.
2023-10-25 13:23:29,187 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet input blocks.
2023-10-25 13:23:29,189 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet output blocks.
2023-10-25 13:23:29,190 - AnimateDiff - INFO - Setting DDIM alpha.
2023-10-25 13:23:29,279 - AnimateDiff - INFO - Injection finished.
2023-10-25 13:23:29,280 - AnimateDiff - INFO - Hacking lora to support motion lora
2023-10-25 13:23:29,281 - AnimateDiff - INFO - Hacking CFGDenoiser forward function.
2023-10-25 13:23:29,282 - AnimateDiff - INFO - Hacking ControlNet.
*** Error completing request
*** Arguments: ('task(cns91yya7wmbdhw)', 0, 'fox astronaut dancing in space', '', [], None, None, None, None, None, None, None, 20, 'DPM++ 2M Karras', 4, 0, 1, 1, 1, 7, 1.5, 0.75, 0, 512, 512, 1, 0, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x0000019501ACF310>, 0, False, '', 0.8, -1, False, -1, 0, 0, 0, <scripts.animatediff_ui.AnimateDiffProcess object at 0x0000019501ACECE0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x0000019501ACE5F0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x0000019501ACF3A0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x0000019501ACFC40>, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50) {}
    Traceback (most recent call last):
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\img2img.py", line 208, in img2img
        processed = process_images(p)
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "E:\waifu\webui2\new\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_cn.py", line 110, in hacked_processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\processing.py", line 803, in process_images_inner
        p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\processing.py", line 1448, in init
        image = images.flatten(img, opts.img2img_background_color)
      File "E:\waifu\webui2\new\stable-diffusion-webui\modules\images.py", line 773, in flatten
        if img.mode == "RGBA":
    AttributeError: 'NoneType' object has no attribute 'mode'

---

Additional information

Hi.

continue-revolution commented 1 year ago

you did not submit an image via webui i2i panel

Gyramuur commented 1 year ago

you did not submit an image via webui i2i panel

That fixed it, thanks! But now for some reason it outputs just noise when using video input?

dangerweenie commented 8 months ago

i'm having the same issue - i dropped a single frame into img2img and then uplaoded a video, but it's only doing a single img2img frame