allow pndm scheduler to be used with ldm pipeline (#165)

This commit is contained in:
Suraj Patil 2022-08-11 14:58:14 +05:30 committed by GitHub
parent c1488ff348
commit 3228eb1609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -79,7 +79,7 @@ class LDMTextToImagePipeline(DiffusionPipeline):
noise_pred = noise_pred_uncond + guidance_scale * (noise_prediction_text - noise_pred_uncond)
# compute the previous noisy sample x_t -> x_t-1
latents = self.scheduler.step(noise_pred, t, latents, eta)["prev_sample"]
latents = self.scheduler.step(noise_pred, t, latents, eta=eta)["prev_sample"]
# scale and decode the image latents with vae
latents = 1 / 0.18215 * latents

View File

@ -116,6 +116,7 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
model_output: Union[torch.FloatTensor, np.ndarray],
timestep: int,
sample: Union[torch.FloatTensor, np.ndarray],
**kwargs,
):
if self.counter < len(self.prk_timesteps):
return self.step_prk(model_output=model_output, timestep=timestep, sample=sample)