unconditional guidance with general s!=1.0

Example: "negative weights"
This commit is contained in:
Robin Rombach 2022-04-04 22:31:35 +02:00 committed by GitHub
parent 4fa9f90f66
commit 32c525011b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,7 @@ class DDIMSampler(object):
b, *_, device = *x.shape, x.device
e_t = self.model.apply_model(x, t, c)
if unconditional_guidance_scale > 1.:
if unconditional_guidance_scale != 1.:
assert unconditional_conditioning is not None
e_t_uncond = self.model.apply_model(x, t, unconditional_conditioning)
e_t = e_t_uncond + unconditional_guidance_scale * (e_t - e_t_uncond)