1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

Fix OSX latent2rgb previews.

This commit is contained in:
comfyanonymous
2024-05-22 13:56:28 -04:00
parent 7718ada4ed
commit 6c23854f54
3 changed files with 11 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import struct
import numpy as np
from comfy.cli_args import args, LatentPreviewMethod
from comfy.taesd.taesd import TAESD
import comfy.model_management
import folder_paths
import comfy.utils
import logging
@@ -43,7 +44,7 @@ class Latent2RGBPreviewer(LatentPreviewer):
latents_ubyte = (((latent_image + 1) / 2)
.clamp(0, 1) # change scale from -1..1 to 0..1
.mul(0xFF) # to 0..255
).to(device="cpu", dtype=torch.uint8, non_blocking=True)
).to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(latent_image.device))
return Image.fromarray(latents_ubyte.numpy())