crowsonkb / k-diffusion

Karras et al. (2022) diffusion models for PyTorch
MIT License
2.26k stars 372 forks source link

sample sigma scheduler bug #37

Open lockmatrix opened 1 year ago

lockmatrix commented 1 year ago

I found that k_diffusion.sampling.get_sigmas_karras returns a list endswith 0, it leads to last dt (sigma[i+1]-sigma[i]) maybe bigger than others, for example:

dt: [-1.3240442276000977, 
-1.1708478927612305, 
-1.0327138900756836, 
-0.9084315299987793, 
-0.7968769073486328, 
-0.6969814300537109, 
-0.6077454090118408, 
-0.5282387733459473, 
-0.4575979709625244, 
-0.39501309394836426, 
-0.3397289514541626, 
-0.2910478115081787, 
-0.24832558631896973, 
-0.21096330881118774, 
-0.17840701341629028, 
-0.1501503586769104, 
-0.12572622299194336, 
-0.10470682382583618, 
-0.08670148253440857, 
-0.07135394215583801, 
-0.05834062397480011, 
-0.04736843705177307, 
-0.03817273676395416, 
-0.030515573918819427,
-0.10000000149011612 **********
]

I think it may be a bug.

This issues is found at https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2794

ghost commented 1 year ago

If my understanding is correct, this is related to #23 (see the first comment), in which case I don't think this is a bug.

lockmatrix commented 1 year ago

If my understanding is correct, this is related to #23 (see the first comment), in which case I don't think this is a bug.

I know the last sigma should be 0, I mean maybe we should reduce all sigmas before 0 to let the last dt become normal.