Switched to trailing timestep spacing to make timesteps for consistant across schedulers. Honed in on targeted guidance. It is finally perfect. (I think)

This commit is contained in:
Jaret Burkett
2023-11-29 14:32:48 -07:00
parent 537af79b0d
commit bd2bce9b92
3 changed files with 12 additions and 68 deletions

View File

@@ -674,14 +674,8 @@ class StableDiffusion:
for idx in range(original_samples.shape[0]):
if scheduler_class_name not in index_noise_schedulers:
# convert to idx
noise_timesteps = [(self.noise_scheduler.timesteps == t).nonzero().item() for t in timesteps_chunks[idx]]
noise_timesteps = torch.tensor(noise_timesteps, device=self.device_torch)
else:
noise_timesteps = timesteps_chunks[idx]
# the add noise for ddpm solver is broken, do it ourselves
noise_timesteps = timesteps_chunks[idx]
if scheduler_class_name == 'DPMSolverMultistepScheduler':
# Make sure sigmas and timesteps have the same device and dtype as original_samples
sigmas = self.noise_scheduler.sigmas.to(device=original_samples_chunks[idx].device, dtype=original_samples_chunks[idx].dtype)