Multi label + general jank

This is probably not what the original paper had in mind for "interpolating between classes" but it mostly works.
This commit is contained in:
City
2023-09-06 19:15:29 +02:00
parent 9840963f5a
commit 06256b6269
3 changed files with 116 additions and 21 deletions
+8
View File
@@ -492,6 +492,12 @@ class GaussianDiffusion:
img = th.randn(*shape, device=device)
indices = list(range(self.num_timesteps))[::-1]
y_inter = None
if "y_inter" in model_kwargs.keys():
if len(model_kwargs["y_inter"]) > 1:
y_inter = model_kwargs["y_inter"]
del model_kwargs["y_inter"]
for i in indices:
t = th.tensor([i] * shape[0], device=device)
with th.no_grad():
@@ -506,6 +512,8 @@ class GaussianDiffusion:
)
yield out
img = out["sample"]
if y_inter: model_kwargs["y"] = y_inter[indices.index(i)%len(y_inter)]
if pbar:
preview_bytes = None
if previewer: