alembics / disco-diffusion

Other
7.45k stars 1.13k forks source link

diffusion_steps (almost) always 1000 if using the pre-filled dropdown values #138

Open scottvr opened 1 year ago

scottvr commented 1 year ago

Section 3, line 3 of the Colab has:

steps = 250 #@param [25,50,100,150,250,500,1000]{type: 'raw', allow-input: true}

Then in Section 4, line 11 there is:

diffusion_steps = (1000//steps)*steps if steps < 1000 else steps

This has the effect of ensuring that if the user selects any of those steps values (other than 150), that diffusion_steps will be assigned 1000, regardless, since all of those numbers are factors of 1000 except for 150. That means up to 40x more steps than the user intended, right? You could fix this and be able to claim a 4000% speedup in best/worst case.

I'd fix it and PR, but I don't know what the intent was here other than I suppose to correct in the unlikely case the user tried to input a float for the number of steps? Regardless of the intent, it looks broken to me. Unless this was the intent:

>>> steplist = [25,50,100,150,250,500,1000]
>>> for steps in steplist:
...  diffusion_steps = (1000//steps)*steps
...  print(f'[{steps}] ... {diffusion_steps})
[25] ... 1000
[50] ... 1000
[100] ... 1000
[150] ... 900
[250] ... 1000
[500] ... 1000
[1000] ... 1000
>>>

The menu will let you select any value that you want, as long as you intend it to be 1000, or 900 (in which case you need to select 150) :-)

Hope that is helpful!