Comfy-Org / Comfy-Org/ComfyUI

Canny preprocessor node does not work when using DirectML

Open
#1,648 4 comments 0 reactions 0 assignees View on GitHub
User Support
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

Windows + RX 570, https://github.com/comfyanonymous/ComfyUI/commit/2ef459b1d4d627929c84d11e5e0cbe3ded9c9f48
```
python main.py --dont-upcast-attention --fp16-vae --use-quad-cross-attention --normalvram --disable-smart-memory --preview-method auto --directml
Using directml with device:
Total VRAM 1024 MB, total RAM 16335 MB
Set vram state to: NORMAL_VRAM
Disabling smart memory management
Device: privateuseone
VAE dtype: torch.float16
disabling upcasting of attention
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention111

Import times for custom nodes:
0.0 seconds: C:\Users\zatoc\Desktop\ComfyUI\custom_nodes\sampler_tonemap.py
0.0 seconds: C:\Users\zatoc\Desktop\ComfyUI\custom_nodes\sampler_rescalecfg.py
0.0 seconds: C:\Users\zatoc\Desktop\ComfyUI\custom_nodes\sampler_tonemap_rescalecfg.py
0.0 seconds: C:\Users\zatoc\Desktop\ComfyUI\custom_nodes\sdxl_model_merging.py
0.0 seconds: C:\Users\zatoc\Desktop\ComfyUI\custom_nodes\advanced_model_merging.py

Starting server

To see the GUI go to: http://127.0.0.1:8188
got prompt
!!! Exception during processing !!!
Traceback (most recent call last):
File "C:\Users\zatoc\Desktop\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "C:\Users\zatoc\Desktop\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "C:\Users\zatoc\Desktop\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "C:\Users\zatoc\Desktop\ComfyUI\comfy_extras\nodes_canny.py", line 293, in detect_edge
output = canny(image.to(comfy.model_management.get_torch_device()).movedim(-1, 1), low_threshold, high_threshold)
File "C:\Users\zatoc\Desktop\ComfyUI\comfy_extras\nodes_canny.py", line 248, in canny
edges: Tensor = F.threshold(magnitude, low_threshold, 0.0)
File "C:\Users\zatoc\Desktop\ComfyUI\venv\lib\site-packages\torch\nn\functional.py", line 1427, in _threshold
result = _VF.threshold(input, threshold, value)
RuntimeError: The parameter is incorrect.
```

Downgrading just nodes_canny.py from https://github.com/comfyanonymous/ComfyUI/commit/d70b0bc43c2d1d0a2212e9493926ddf231c80a41 to https://github.com/comfyanonymous/ComfyUI/commit/bdba3942903f59b96d08b95c878eb616c429e5d4 makes it work, assumedly because it is not running on the GPU and running into this issue with DirectML.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.