add alternative guidance strategy

This commit is contained in:
rromb 2022-06-13 23:35:05 +02:00
parent fe081960ca
commit 6663c9bb71

View file

@ -1553,6 +1553,9 @@ class LatentUpscaleDiffusion(LatentDiffusion):
if k == "c_crossattn": if k == "c_crossattn":
assert isinstance(c[k], list) and len(c[k]) == 1 assert isinstance(c[k], list) and len(c[k]) == 1
uc[k] = [uc_tmp] uc[k] = [uc_tmp]
elif k == "c_adm":
assert isinstance(c[k], torch.Tensor)
uc[k] = torch.ones_like(c[k]) * (self.low_scale_model.max_max_noise_level-1)
elif isinstance(c[k], list): elif isinstance(c[k], list):
uc[k] = [torch.zeros_like(c[k][i]) for i in range(len(c[k]))] uc[k] = [torch.zeros_like(c[k][i]) for i in range(len(c[k]))]
else: else: