overal quality fixes

This commit is contained in:
Vladimir Mandic
2023-07-08 09:49:41 -04:00
parent 816876c8ac
commit 89a7ea6a3f
14 changed files with 68 additions and 74 deletions
+1 -3
View File
@@ -174,7 +174,6 @@ class DDPM(pl.LightningModule):
lvlb_weights = 0.5 * np.sqrt(torch.Tensor(alphas_cumprod)) / (2. * 1 - torch.Tensor(alphas_cumprod))
else:
raise NotImplementedError("mu not supported")
# TODO how to choose this term
lvlb_weights[0] = lvlb_weights[1]
self.register_buffer('lvlb_weights', lvlb_weights, persistent=False)
assert not torch.isnan(self.lvlb_weights).all()
@@ -887,7 +886,7 @@ class LatentDiffusion(DDPM):
assert c is not None
if self.cond_stage_trainable:
c = self.get_learned_conditioning(c)
if self.shorten_cond_schedule: # TODO: drop this option
if self.shorten_cond_schedule:
tc = self.cond_ids[t].to(self.device)
c = self.q_sample(x_start=c, t=tc, noise=torch.randn_like(c.float()))
return self.p_losses(x, c, t, *args, **kwargs)
@@ -1430,7 +1429,6 @@ class DiffusionWrapper(pl.LightningModule):
class Layout2ImgDiffusion(LatentDiffusion):
# TODO: move all layout-specific hacks to this class
def __init__(self, cond_stage_key, *args, **kwargs):
assert cond_stage_key == 'coordinates_bbox', 'Layout2ImgDiffusion only for cond_stage_key="coordinates_bbox"'
super().__init__(*args, cond_stage_key=cond_stage_key, **kwargs)