basujindal / stable-diffusion

Optimized Stable Diffusion modified to run on lower GPU VRAM
Other
3.14k stars 469 forks source link

Out-of-bounds index errors for select img2img inputs owing to steps_out = ddim_timesteps + 1 #52

Open jtkelm2 opened 2 years ago

jtkelm2 commented 2 years ago

It took a bit of tracing through the callstack to find out what was the matter when I ran certain img2img parameters (such as ddim_steps = 27 and strength = 1), but I believe it is this line in util.py for the make_ddim_timesteps method: steps_out = ddim_timesteps + 1. Consequently the last index may be 1000, triggering an OOB error later when it tries to access the 1000th element of alphacums.

There is this comment in the code to explain the +1:

# add one to get the final alpha values right (the ones from first scale to data during sampling)

but I don't know what to make of it. Is this necessary?

sparta218 commented 2 years ago

Can confirm I also get OOB returns when I set 'strength = 1'

TapuCosmo commented 2 years ago

I get the error when I increase ddim_steps above 250.