mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix off-by-one error
This commit is contained in:
parent
7a3eae4572
commit
483097f31c
@ -45,7 +45,6 @@ class KSampler(Sampler):
|
|||||||
ddim_eta=0.0,
|
ddim_eta=0.0,
|
||||||
verbose=False,
|
verbose=False,
|
||||||
):
|
):
|
||||||
ddim_num_steps += 1
|
|
||||||
outer_model = self.model
|
outer_model = self.model
|
||||||
self.model = outer_model.inner_model
|
self.model = outer_model.inner_model
|
||||||
super().make_schedule(
|
super().make_schedule(
|
||||||
@ -56,16 +55,6 @@ class KSampler(Sampler):
|
|||||||
)
|
)
|
||||||
self.model = outer_model
|
self.model = outer_model
|
||||||
self.ddim_num_steps = ddim_num_steps
|
self.ddim_num_steps = ddim_num_steps
|
||||||
# not working quite right
|
|
||||||
# sigmas = K.sampling.get_sigmas_karras(
|
|
||||||
# n=ddim_num_steps,
|
|
||||||
# sigma_min=self.model.sigmas[0].item(),
|
|
||||||
# sigma_max=self.model.sigmas[-1].item(),
|
|
||||||
# rho=7.,
|
|
||||||
# device=self.device,
|
|
||||||
# # Birch-san recommends this, but it doesn't match the call signature in his branch of k-diffusion
|
|
||||||
# # concat_zero=False
|
|
||||||
# )
|
|
||||||
sigmas = self.model.get_sigmas(ddim_num_steps)
|
sigmas = self.model.get_sigmas(ddim_num_steps)
|
||||||
self.sigmas = sigmas
|
self.sigmas = sigmas
|
||||||
|
|
||||||
@ -102,14 +91,14 @@ class KSampler(Sampler):
|
|||||||
# this has to come in the same format as the conditioning, # e.g. as encoded tokens, ...
|
# this has to come in the same format as the conditioning, # e.g. as encoded tokens, ...
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
S += 1
|
|
||||||
def route_callback(k_callback_values):
|
def route_callback(k_callback_values):
|
||||||
if img_callback is not None:
|
if img_callback is not None:
|
||||||
img_callback(k_callback_values['x'],k_callback_values['i'])
|
img_callback(k_callback_values['x'],k_callback_values['i'])
|
||||||
|
|
||||||
# sigmas = self.model.get_sigmas(S)
|
# sigmas = self.model.get_sigmas(S)
|
||||||
# sigmas are now set up in make_schedule - we take the last steps items
|
# sigmas are now set up in make_schedule - we take the last steps items
|
||||||
sigmas = self.sigmas[-S:]
|
sigmas = self.sigmas[-S-1:]
|
||||||
|
|
||||||
if x_T is not None:
|
if x_T is not None:
|
||||||
x = x_T * sigmas[0]
|
x = x_T * sigmas[0]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user