mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-12 03:57:04 +08:00
Only convert to unint8 if directml_enabled
This commit is contained in:
parent
5ed09898bb
commit
79c526f5c0
@ -13,7 +13,8 @@ def preview_to_image(latent_image):
|
|||||||
latents_ubyte = (((latent_image + 1.0) / 2.0).clamp(0, 1) # change scale from -1..1 to 0..1
|
latents_ubyte = (((latent_image + 1.0) / 2.0).clamp(0, 1) # change scale from -1..1 to 0..1
|
||||||
.mul(0xFF) # to 0..255
|
.mul(0xFF) # to 0..255
|
||||||
)
|
)
|
||||||
latents_ubyte = latents_ubyte.to(dtype=torch.uint8)
|
if comfy.model_management.directml_enabled:
|
||||||
|
latents_ubyte = latents_ubyte.to(dtype=torch.uint8)
|
||||||
latents_ubyte = latents_ubyte.to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(latent_image.device))
|
latents_ubyte = latents_ubyte.to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(latent_image.device))
|
||||||
|
|
||||||
return Image.fromarray(latents_ubyte.numpy())
|
return Image.fromarray(latents_ubyte.numpy())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user