deforum-art / sd-webui-deforum

Deforum extension for AUTOMATIC1111's Stable Diffusion webui
https://deforum.github.io
Other
2.69k stars 389 forks source link

[Bug]: Error + stack when missing keyframe at 0 #482

Closed ryango closed 1 year ago

ryango commented 1 year ago

Have you read the latest version of the FAQ?

Is there an existing issue for this?

Are you using the latest version of the Deforum extension?

What happened?

Error if missing keyframe at 0 (I think this same trace can happen other ways too)

Traceback (most recent call last):
  File "C:\Users\rg113\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\rg113\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "C:\Users\rg113\stable-diffusion-webui\extensions\deforum\scripts\deforum.py", line 85, in run_deforum
    render_animation(args, anim_args, video_args, parseq_args, loop_args, controlnet_args, root.animation_prompts, root)
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\render.py", line 61, in render_animation
    keys = DeformAnimKeys(anim_args, args.seed) if not use_parseq else ParseqAnimKeys(parseq_args, anim_args, video_args)
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\animation_key_frames.py", line 17, in __init__
    self.rotation_3d_x_series = self.fi.get_inbetweens(self.fi.parse_key_frames(anim_args.rotation_3d_x))
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\animation_key_frames.py", line 83, in get_inbetweens
    if not value_is_number:
UnboundLocalError: local variable 'value_is_number' referenced before assignment

The error is this line, which is referencing value_is_number

I suspect the fix is just to indent that block, and just changing it to an else but I'm not too familiar with the intended behavior

Steps to reproduce the problem

  1. Take default Deforum settings
  2. Change any transform keyframe from a 0 to a 1
  3. See error in logs and Deforum fails

What should have happened?

I would expect the first keyframe in the series, whether 0 or later, to dictate keyframes before

WebUI and Deforum extension Commit IDs

webui commit id - 3e0f9a75438fa815429b5530261bcf7d80f3f101 deforum exten commit id - 5a98dc2bd08b0f9e6758ecff448f340e62c60044

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

Local PC setup (Windows)

Deforum settings

https://gist.github.com/ryango/dee6c1dcb25328c2c702fd9e126b7c6a

Webui core settings

https://gist.github.com/ryango/4af42da0c6aa2320c91bb60dbe981675

Console logs

.\webui.bat --xformers
venv "C:\Users\rg113\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
Commit hash: 3e0f9a75438fa815429b5530261bcf7d80f3f101
Installing requirements for Web UI

Launching Web UI with arguments: --xformers
==============================================================================
You are running torch 1.12.1+cu113.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
=================================================================================
You are running xformers 0.0.14.dev.
The program is tested to work with xformers 0.0.16rc425.
To reinstall the desired version, run with commandline flag --reinstall-xformers.

Use --skip-version-check commandline argument to disable this check.
=================================================================================
Loading weights [9aba26abdf] from C:\Users\rg113\stable-diffusion-webui\models\Stable-diffusion\deliberate_v2.safetensors
Creating model from config: C:\Users\rg113\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Model loaded in 3.1s (create model: 0.3s, apply weights to model: 1.0s, apply half(): 0.5s, move model to device: 0.7s, load textual inversion embeddings: 0.6s).
*Deforum ControlNet support: enabled*
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Deforum extension for auto1111 webui, v2.3b
Git commit: Unknown
Error completing request
Arguments: ('task(gnwe3seuh6rp8iz)', None, False, '', '2D', 120, 'replicate', '0:(0)', '0:(1.0025+0.002*sin(1.25*3.14*t/30))', '0:(0)', '0:(0)', '0:(1.75)', '1:(0.5)', '0:(0.5)', '0:(0)', '0:(0)', '0:(0)', False, '0:(0)', '0:(0)', '0:(0)', '0:(53)', '0: (0.065)', '0: (0.65)', '0: (1.0)', '0: (7)', '0:(1.5)', False, '0:(1)', '0:(0)', False, '0: (25)', '0: (70)', '0: (1)', '0: (200)', '0: (10000)', '0:(s), 1:(-1), "max_f-2":(-1), "max_f-1":(s)', False, '0: ("Euler a")', '0: ("{video_mask}")', False, '0: ("{video_mask}")', False, '0: ("model1.ckpt"), 100: ("model2.ckpt")', False, '0: (2)', True, '0: (1.05)', '0: (5)', '0: (1.0)', '0: (0.1)', '0: (0.0)', 'LAB', '', 1.0, False, '2', False, '2', 'perlin', 8, 8, 4, 0.5, True, 0.2, 'border', 'bicubic', False, 'https://deforum.github.io/a1/V1.mp4', 1, 0, -1, False, False, 'https://deforum.github.io/a1/VM1.mp4', False, '20230129210106', '{\n    "0": "tiny cute swamp bunny, highly detailed, intricate, ultra hd, sharp photo, crepuscular rays, in focus, by tomasz alen kopera",\n    "30": "anthropomorphic clean cat, surrounded by fractals, epic angle and pose, symmetrical, 3d, depth of field, ruan jia and fenghua zhong",\n    "60": "a beautiful coconut --neg photo, realistic",\n    "90": "a beautiful durian, trending on Artstation"\n}\n    ', '', '', 512, 512, False, False, -1, 'Euler a', False, 0, 0, 25, 0.0, 1, True, True, False, False, False, 'Deforum', '{timestring}_{index}_{prompt}.png', 'iter', 1, False, False, True, 0.8, 'https://deforum.github.io/a1/I1.png', False, False, False, True, 'https://deforum.github.io/a1/M1.jpg', 1.0, 1.0, 4, 1, True, 4, 'reroll', False, 15, False, False, 'FFMPEG mp4', 'C:\\Users\\rg113\\stable-diffusion-webui\\venv\\lib\\site-packages\\imageio_ffmpeg\\binaries\\ffmpeg-win64-v4.2.2.exe', '17', 'slow', 'None', 'https://deforum.github.io/a1/A1.mp3', False, 'realesr-animevideov3', 'x2', True, False, 'x0_pred', 'C:/SD/20230124234916_%09d.png', 'testvidmanualsettings.mp4', False, 'None', 2, False, 2, False, '', True, False, 'None', True, 'None', False, 'Farneback', False, 'None', False, 'None', False, False, '0:(1)', '0:(0.5)', '0:(1)', '0:(100)', '0:(0)', False, '{\n    "0": "https://deforum.github.io/a1/Gi1.png",\n    "max_f/4-5": "https://deforum.github.io/a1/Gi2.png",\n    "max_f/2-10": "https://deforum.github.io/a1/Gi3.png",\n    "3*max_f/4-15": "https://deforum.github.io/a1/Gi4.jpg",\n    "max_f-20": "https://deforum.github.io/a1/Gi1.png"\n}', '0:(0.75)', '0:(0.35)', '0:(0.25)', '0:(20)', '0:(0.075)', None, None, True, '', '', False, False, False, False, False, 'none', 'None', 1, 0, 1, 64, 64, 64, 'Scale to Fit (Inner Fit)') {}
Traceback (most recent call last):
  File "C:\Users\rg113\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\rg113\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "C:\Users\rg113\stable-diffusion-webui\extensions\deforum\scripts\deforum.py", line 85, in run_deforum
    render_animation(args, anim_args, video_args, parseq_args, loop_args, controlnet_args, root.animation_prompts, root)
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\render.py", line 61, in render_animation
    keys = DeformAnimKeys(anim_args, args.seed) if not use_parseq else ParseqAnimKeys(parseq_args, anim_args, video_args)
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\animation_key_frames.py", line 11, in __init__
    self.transform_center_x_series = self.fi.get_inbetweens(self.fi.parse_key_frames(anim_args.transform_center_x))
  File "C:\Users\rg113\stable-diffusion-webui/extensions/deforum/scripts\deforum_helpers\animation_key_frames.py", line 83, in get_inbetweens
    if not value_is_number:
UnboundLocalError: local variable 'value_is_number' referenced before assignment

Additional information

No response

hithereai commented 1 year ago

This is a classic "it's not a bug, it's a feature".

What would you expect the code to do at the first frame then? Just random number? You need a starting point, and that starting point is frame 0.