Skip to content

Commit 58c9838

Browse files
Speed up TAESD preview.
1 parent b02bcce commit 58c9838

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

latent_preview.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ def __init__(self, taesd):
2525

2626
def decode_latent_to_preview(self, x0):
2727
x_sample = self.taesd.decode(x0[:1])[0].detach()
28-
x_sample = torch.clamp((x_sample + 1.0) / 2.0, min=0.0, max=1.0)
29-
x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2)
30-
x_sample = x_sample.astype(np.uint8)
28+
x_sample = 255. * torch.clamp((x_sample + 1.0) / 2.0, min=0.0, max=1.0)
29+
x_sample = np.moveaxis(x_sample.to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(x_sample.device)).numpy(), 0, 2)
3130

3231
preview_image = Image.fromarray(x_sample)
3332
return preview_image

0 commit comments

Comments
 (0)