continue-revolution / sd-webui-animatediff

AnimateDiff for AUTOMATIC1111 Stable Diffusion WebUI
Other
3.08k stars 255 forks source link

[Bug]: Generating keeps failing with TypeError: 'NoneType' object is not iterable #438

Closed Atomzk closed 7 months ago

Atomzk commented 7 months ago

Is there an existing issue for this?

Have you read FAQ on README?

What happened?

Installed AnimateDiff on Forge from the extensions tab, with several motion modules. Whenever I enable AnimateDiff and select a motion module, I always get the same "object is not iterable" error. When no module is selected, 18 images get generated and turned into a gif, but that's just random images without animation. It doesn't matter what checkpoint, sampling method or motion model I choose, the result is always the same.

Steps to reproduce the problem

  1. Enter a prompt
  2. Activate AnimateDiff
  3. Press Generate

What should have happened?

An animated gif

Commit where the problem happens

version: f0.0.14v1.8.0rc-latest-184-g43c9e3b5  •  python: 3.10.6  •  torch: 2.1.2+cu121  •  xformers: N/A  •  gradio: 3.41.2  •  https://github.com/continue-revolution/sd-webui-animatediff/commit/4c3ec2e5fbba4395330da118af57d82d672f46d2

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

Forge requires no arguments. This is what it detects.

Launching Web UI with arguments:
Total VRAM 16376 MB, total RAM 31967 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4080 : native
VAE dtype: torch.bfloat16

Console logs

*** Error running before_process: C:\Users\user\Forge\stable-diffusion-webui-forge\extensions\sd-webui-animatediff\scripts\animatediff.py
    Traceback (most recent call last):
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\scripts.py", line 795, in before_process
        script.before_process(p, *script_args)
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\extensions\sd-webui-animatediff\scripts\animatediff.py", line 64, in before_process
        motion_module.inject(p.sd_model, params.model)
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\extensions\sd-webui-animatediff\scripts\animatediff_mm.py", line 59, in inject
        self.restore(sd_model)
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\extensions\sd-webui-animatediff\scripts\animatediff_mm.py", line 151, in restore
        if sd_model.lowvram:
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\nn\modules\module.py", line 1695, in __getattr__
        raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
    AttributeError: 'LatentDiffusion' object has no attribute 'lowvram'

---
  0%|                                                                                           | 0/20 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules_forge\main_thread.py", line 37, in loop
    task.work()
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules_forge\main_thread.py", line 26, in work
    self.result = self.func(*self.args, **self.kwargs)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\txt2img.py", line 111, in txt2img_function
    processed = processing.process_images(p)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\processing.py", line 750, in process_images
    res = process_images_inner(p)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\processing.py", line 921, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\processing.py", line 1276, in sample
    samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\sd_samplers_kdiffusion.py", line 251, in sample
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\sd_samplers_common.py", line 263, in launch_sampling
    return func()
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\sd_samplers_kdiffusion.py", line 251, in <lambda>
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\repositories\k-diffusion\k_diffusion\sampling.py", line 594, in sample_dpmpp_2m
    denoised = model(x, sigmas[i] * s_in, **extra_args)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\user\Forge\stable-diffusion-webui-forge\extensions\sd-webui-animatediff\scripts\animatediff_infv2v.py", line 174, in mm_cfg_forward
    if sd_samplers_common.apply_refiner(self):
TypeError: apply_refiner() missing 1 required positional argument: 'x'
apply_refiner() missing 1 required positional argument: 'x'
*** Error completing request
*** Arguments: ('task(nqmqtsrbrn0ey3x)', <gradio.routes.Request object at 0x000001BC9B0093C0>, 'a crab on the beach', '', [], 20, 'DPM++ 2M Karras', 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], 0, False, '', 0.8, -1, False, -1, 0, 0, 0, <scripts.animatediff_ui.AnimateDiffProcess object at 0x000001BC9B0089D0>, ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), False, 7, 1, 'Constant', 0, 'Constant', 0, 1, 'enable', 'MEAN', 'AD', 1, False, 1.01, 1.02, 0.99, 0.95, False, 0.5, 2, False, 256, 2, 0, False, False, 3, 2, 0, 0.35, True, 'bicubic', 'bicubic', False, 0, 'anisotropic', 0, 'reinhard', 100, 0, 'subtract', 0, 0, 'gaussian', 'add', 0, 100, 127, 0, 'hard_clamp', 5, 0, 'None', 'None', False, 'MultiDiffusion', 768, 768, 64, 4, False, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "C:\Users\user\Forge\stable-diffusion-webui-forge\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
    TypeError: 'NoneType' object is not iterable

Additional information

Not sure what "apply_refiner" is about. The refiner option is not enabled.

continue-revolution commented 7 months ago

Did you switch branch? You need to be at forge/master branch.

zopi4k commented 7 months ago

I report an experience where I encountered this bug after switching Checkpoints. Unfortunately, this required me to repeatedly request regeneration in order for the process to function properly. I was surprised to discover this bug after many and many generations there had not been this bug it was just by changing Checkpoint.

Atomzk commented 7 months ago

Did you switch branch? You need to be at forge/master branch.

No, I used the main branche. You mean https://github.com/lllyasviel/stable-diffusion-webui-forge/tree/dev ?

zopi4k commented 7 months ago

No, I used the main branche. You mean https://github.com/lllyasviel/stable-diffusion-webui-forge/tree/dev ?

You said : " Installed AnimateDiff on Forge from the extensions tab " you need to go in your animatediff extention folder "extensions\sd-webui-animatediff", enter " cmd " in the url folder to open the terminal. Use " git checkout forge/master " to switch the branch.

Or you can delete the AnimatedDiff folder to use https://github.com/continue-revolution/sd-forge-animatediff.git in your extention tab > "Instal from URL" panel

Atomzk commented 7 months ago

Or you can delete the AnimatedDiff folder to use https://github.com/continue-revolution/sd-forge-animatediff.git in your extention tab > "Instal from URL" panel

Thanks, that did the trick.