ComfyUI-layerdiffuse icon indicating copy to clipboard operation
ComfyUI-layerdiffuse copied to clipboard

[Bug]: The Issue of y.shape[1] == 4 and Directml, a lack of torch.median() and the solution.

Open MythicalChu opened this issue 11 months ago • 0 comments

What happened?

Everyone on Directml will fail to use this node encountering the tuple error.

Steps to reproduce the problem

Be me. Be everyone using DirectML. ??? Don't profit. Ever.

What should have happened?

~Alpha Translucentiation~

Commit where the problem happens

ComfyUI: ComfyUI-layerdiffuse:

Sysinfo

AMD, DirectML, Pain Incarnate.

Console logs

-

Workflow json file

Additional information

I had posted about this on forge's layerdiffuse and totally forgot, my bad. There I detail the exact cause of the problem and the workaround: https://github.com/layerdiffusion/sd-forge-layerdiffuse/issues/10#issue-2164698715

tl;dr: on line 300 of lib_layerdiffusion\modesl.py , median = torch.median(result, dim=0).values FAILS. DirectML doesn't know torch.median() . The solution is to cast the previous line .to("cpu") and the next line back .to(self.load_device)

So, lines 299, 300, 301 look like this: result = torch.stack(result, dim=0).to("cpu") median = torch.median(result, dim=0).values return median.to(self.load_device)

MythicalChu avatar Mar 11 '24 02:03 MythicalChu