kabachuha / sd-webui-text2video

Auto1111 extension implementing text2video diffusion models (like ModelScope or VideoCrafter) using only Auto1111 webui dependencies
Other
1.28k stars 106 forks source link

[Bug]: AttributeError: 'NoneType' object has no attribute 'ema_scope' #118

Closed randaller closed 1 year ago

randaller commented 1 year ago

Is there an existing issue for this?

Are you using the latest version of the extension?

What happened?

Trying to do txt2img after txt2video crashes with 'NoneType' object has no attribute 'ema_scope'.

I am running auto1111 using keys: --api --listen --medvram --xformers

It seems, sd doesn't know that model was unloaded.

There were an old issue with probably a way how to fix this fast: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4257

Probably, adding this somewhere could help.

p.sd_model = None
p.sampler = None

Steps to reproduce the problem

  1. Generate any txt2video
  2. Try to generate any txt2img using UI or api.

What should have happened?

sd should reload models and work further

WebUI and Deforum extension Commit IDs

webui commit id - 22bcc7be428c94e9408f589966c2040187245d81 txt2vid commit id - 9b79cb8d (Sun Apr 16 12:17:20 2023)

What GPU were you using for launching?

3070ti

On which platform are you launching the webui backend with the extension?

Local PC setup (Windows)

Settings

image

Console logs

Video stitching done in 0.40 seconds!
t2v complete, result saved at D:\Dev\NN\github\pytorch\stable-diffusion-webui\outputs/img2img-images\text2video\20230416181144
Error running process: D:\Dev\NN\github\pytorch\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py
Traceback (most recent call last):
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\scripts.py", line 417, in process
    script.process(p, *script_args)
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 625, in process
    unet = p.sd_model.model.diffusion_model
AttributeError: 'NoneType' object has no attribute 'model'

Error completing request
Arguments: ('task(e31izebk4bntol8)', '', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 0, <scripts.external_code.ControlNetUnit object at 0x000002620A44E770>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0, None, False, 50, False, 4.0, '', 10.0, 'Linear', 3, False, 30.0, True, False, False, 0, 0.0, 'Lanczos', 1, True, 0, 0, 0.001, 75, 0.0, False, True) {}
Traceback (most recent call last):
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\processing.py", line 503, in process_images
    res = process_images_inner(p)
  File "D:\Dev\NN\github\pytorch\stable-diffusion-webui\modules\processing.py", line 592, in process_images_inner
    with torch.no_grad(), p.sd_model.ema_scope():
AttributeError: 'NoneType' object has no attribute 'ema_scope'

Additional information

No response

OsmondFan commented 1 year ago

there's also: stable-diffusion-webui/extensions/sd-webui-text2video/scripts/modelscope/t2v_model.py", line 504, in forward sim.maskedfill(~mask, max_neg_value) TypeError: bad operand type for unary ~: 'NoneType' Exception occurred: bad operand type for unary ~: 'NoneType'

github-actions[bot] commented 1 year ago

This issue has been closed due to incorrect formatting. Please address the following mistakes and reopen the issue: