Fix canny node not working with fp16. (#13085)
This commit is contained in:
@@ -3,6 +3,7 @@ from typing_extensions import override
|
|||||||
|
|
||||||
import comfy.model_management
|
import comfy.model_management
|
||||||
from comfy_api.latest import ComfyExtension, io
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
import torch
|
||||||
|
|
||||||
|
|
||||||
class Canny(io.ComfyNode):
|
class Canny(io.ComfyNode):
|
||||||
@@ -29,8 +30,8 @@ class Canny(io.ComfyNode):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, image, low_threshold, high_threshold) -> io.NodeOutput:
|
def execute(cls, image, low_threshold, high_threshold) -> io.NodeOutput:
|
||||||
output = canny(image.to(comfy.model_management.get_torch_device()).movedim(-1, 1), low_threshold, high_threshold)
|
output = canny(image.to(device=comfy.model_management.get_torch_device(), dtype=torch.float32).movedim(-1, 1), low_threshold, high_threshold)
|
||||||
img_out = output[1].to(comfy.model_management.intermediate_device()).repeat(1, 3, 1, 1).movedim(1, -1)
|
img_out = output[1].to(device=comfy.model_management.intermediate_device(), dtype=comfy.model_management.intermediate_dtype()).repeat(1, 3, 1, 1).movedim(1, -1)
|
||||||
return io.NodeOutput(img_out)
|
return io.NodeOutput(img_out)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user