old python version compat

This commit is contained in:
lunar 2022-12-09 14:03:20 +00:00
parent ab500dd288
commit 87ca894694
1 changed files with 114 additions and 119 deletions

View File

@ -224,11 +224,8 @@ class StableDiffusionHolder:
precision_scope = autocast if self.precision == "autocast" else nullcontext
generator = torch.Generator(device=self.device).manual_seed(int(self.seed))
with (
precision_scope("cuda"),
self.model.ema_scope(),
):
with precision_scope("cuda"):
with self.model.ema_scope():
if self.guidance_scale != 1.0:
uc = self.model.get_learned_conditioning([""])
else:
@ -318,10 +315,8 @@ class StableDiffusionHolder:
precision_scope = autocast if self.precision == "autocast" else nullcontext
generator = torch.Generator(device=self.device).manual_seed(int(self.seed))
with (
precision_scope("cuda"),
self.model.ema_scope(),
):
with precision_scope("cuda"):
with self.model.ema_scope():
batch = make_batch_sd(self.image_source, self.mask_image, txt="willbereplaced", device=self.device, num_samples=1)
c = text_embeddings