Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #30

Open
oliverban opened this issue Sep 19, 2023 · 7 comments
Open

IndexError: list index out of range #30

oliverban opened this issue Sep 19, 2023 · 7 comments

Comments

@oliverban
Copy link

I get the same error as another user but with different error lines. After "Run 1st Key Frame" which works well, I get my style.
Then running "Run Key Frames" gives:

Traceback (most recent call last):
File "c:\python\lib\site-packages\gradio\queueing.py", line 388, in call_prediction
output = await route_utils.call_process_api(
File "c:\python\lib\site-packages\gradio\route_utils.py", line 219, in call_process_api
output = await app.get_blocks().process_api(
File "c:\python\lib\site-packages\gradio\blocks.py", line 1437, in process_api
result = await self.call_function(
File "c:\python\lib\site-packages\gradio\blocks.py", line 1109, in call_function
prediction = await anyio.to_thread.run_sync(
File "c:\python\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "c:\python\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "c:\python\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "c:\python\lib\site-packages\gradio\utils.py", line 641, in wrapper
response = f(*args, **kwargs)
File "c:\python\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Oliver\Documents\Github\Rerender_A_Video\webUI.py", line 550, in process2
samples, _ = ddim_v_sampler.sample(
File "c:\python\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Oliver\Documents\Github\Rerender_A_Video\src\ddim_v_hacked.py", line 212, in sample
samples, intermediates = self.ddim_sampling(
File "c:\python\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Oliver\Documents\Github\Rerender_A_Video\src\ddim_v_hacked.py", line 312, in ddim_sampling
weight = mask[i]
IndexError: list index out of range

And then I read something about dividing doing some frame math myself, but I don't know the formula/equation I should use for that.

@williamyang1991
Copy link
Owner

Did you change the DDIM step? Changing the DDIM step might cause this issue.
Make sure cfg.ddim_steps * cfg.mask_period[0] and cfg.ddim_steps * cfg.mask_period[1] are integers.

if i <= cfg.ddim_steps * cfg.mask_period[

@oliverban
Copy link
Author

Did you change the DDIM step? Changing the DDIM step might cause this issue. Make sure cfg.ddim_steps * cfg.mask_period[0] and cfg.ddim_steps * cfg.mask_period[1] are integers.

if i <= cfg.ddim_steps * cfg.mask_period[

In the webUI I might've changed the steps, yes. If there are specific requirements for that and not being able to change it, that should be stated. There seems to be too many settings that should be "hard baked" into the process, removing the sliders (if they aren't created as variables that change the underlying math so it works anyways).

Please reconsider how this is implemented, i.e, maybe make a check for integers and if not, put that out as a error. I do understand this is very new so I hope it can be made more flexible in the future - I'll come back to this one when it is ready!

@williamyang1991
Copy link
Owner

We have fixed it. We add a constraint to ensure the steps to be a multiple of 20.

Rerender_A_Video/webUI.py

Lines 703 to 707 in 7cc5914

ddim_steps = gr.Slider(label='Steps',
minimum=20,
maximum=100,
value=20,
step=20)

@oliverban
Copy link
Author

We have fixed it. We add a constraint to ensure the steps to be a multiple of 20.

Rerender_A_Video/webUI.py

Lines 703 to 707 in 7cc5914

ddim_steps = gr.Slider(label='Steps',
minimum=20,
maximum=100,
value=20,
step=20)

Awesome news! :) I'll update ASAP!

@williamyang1991
Copy link
Owner

We would like to provide more flexible options for users to try. However, this may introduce some unexpected conflict.
Thus, we are actively discovering and solving these issues.

Hope this update will solve your IndexError: list index out of range error

@Jerx2y
Copy link

Jerx2y commented Oct 24, 2023

I've changed the maximum of steps = 120 and set the steps = 120 and got the same error. How to "run all" when setting the steps = 120 or more?

@williamyang1991
Copy link
Owner

williamyang1991 commented Oct 24, 2023

@Jerx2y the mask is generated here.

Rerender_A_Video/webUI.py

Lines 540 to 545 in a348e0a

for i in range(cfg.ddim_steps):
if i <= cfg.ddim_steps * cfg.mask_period[
0] or i >= cfg.ddim_steps * cfg.mask_period[1]:
masks += [None]
else:
masks += [mask * cfg.mask_strength]

You can check the length of the mask (len(masks)).
And see whether it is smaller than the total running steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants