Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding comfyui attention mode #2

Closed
al3dv2 opened this issue Dec 3, 2024 · 17 comments
Closed

Adding comfyui attention mode #2

al3dv2 opened this issue Dec 3, 2024 · 17 comments

Comments

@al3dv2
Copy link

al3dv2 commented Dec 3, 2024

Hi flash_attn and sageattn doesn't works on my windows 10 (24go de vram ) I tried everything for install it without sucess can you add others attention mode like the comfyui one ? thanks !

@SUP3RMASS1VE
Copy link

same problem here.

@kijai
Copy link
Owner

kijai commented Dec 3, 2024

The issue isn't adding them, they just don't work with the model, even the original code only works with flash_attn. Sdpa is already an option, but it didn't produce movement on my tests so far.

Both flash and sage can be installed on Windows, it's not super simple but very much possible. Sage is also a lot faster so it can be worth the effort, depending on your GPU.

@al3dv2
Copy link
Author

al3dv2 commented Dec 3, 2024

Ok thanks for the answer do you know where there's a tutorial for install it on windows because pip install never works for both

@SUP3RMASS1VE
Copy link

The issue isn't adding them, they just don't work with the model, even the original code only works with flash_attn. Sdpa is already an option, but it didn't produce movement on my tests so far.

Both flash and sage can be installed on Windows, it's not super simple but very much possible. Sage is also a lot faster so it can be worth the effort, depending on your GPU.

sdpa working for me but as you said no movement just pixelated movements

@kijai
Copy link
Owner

kijai commented Dec 3, 2024

Ok thanks for the answer do you know where there's a tutorial for install it on windows because pip install never works for both

It's more complicated than that, Purz made this guide a while ago that should still apply:

https://purz.notion.site/Get-Windows-Triton-working-for-Mochi-6a0c055e21c84cfba7f1dd628e624e97

@power88
Copy link

power88 commented Dec 4, 2024

Here's a prebuilt triton package from this huggingface repo:
https://huggingface.co/madbuda/triton-windows-builds/tree/main
You can download one of them and install

@tarkansarim
Copy link

Ok thanks for the answer do you know where there's a tutorial for install it on windows because pip install never works for both

It's more complicated than that, Purz made this guide a while ago that should still apply:

https://purz.notion.site/Get-Windows-Triton-working-for-Mochi-6a0c055e21c84cfba7f1dd628e624e97

Did that and now getting this error.
RuntimeError: Failed to find C compiler. Please specify via CC environment variable.

@4lt3r3go
Copy link

4lt3r3go commented Dec 4, 2024

is weird cause after i finally figured how to make Triton works for Mochi (wich is actually working now)
i can't run sage_att with the workflow shared here

Can't import SageAttention: cannot import name 'sageattn_varlen' from 'sageattention' (F:\Comfy2\python_embeded\Lib\site-packages\sageattention\__init__.py)

sdpa gives me pixelated results too

Here's a prebuilt triton package from this huggingface repo: https://huggingface.co/madbuda/triton-windows-builds/tree/main You can download one of them and install

@walkingwithGod2017
Copy link

is weird cause after a lot of issues i had to figure to make Triton works for Mochi (and is actually working now) but i can't run sage_att with the workflow shared here Can't import SageAttention: cannot import name 'sageattn_varlen' from 'sageattention' (F:\Comfy2\python_embeded\Lib\site-packages\sageattention\__init__.py)

sdpa gives me pixelated results too

Here's a prebuilt triton package from this huggingface repo: https://huggingface.co/madbuda/triton-windows-builds/tree/main You can download one of them and install

the same error msg.

@4lt3r3go
Copy link

4lt3r3go commented Dec 4, 2024

Hi flash_attn and sageattn doesn't works on my windows 10 (24go de vram ) I tried everything for install it without sucess can you add others attention mode like the comfyui one ? thanks !

i would add at least the word "Sage" in the main title of this post or something like that
cause expect more people entering with the same problem
at least we can converge everything in here

@kijai
Copy link
Owner

kijai commented Dec 4, 2024

is weird cause after i finally figured how to make Triton works for Mochi (wich is actually working now)
i can't run sage_att with the workflow shared here

Can't import SageAttention: cannot import name 'sageattn_varlen' from 'sageattention' (F:\Comfy2\python_embeded\Lib\site-packages\sageattention\__init__.py)

sdpa gives me pixelated results too

Here's a prebuilt triton package from this huggingface repo: https://huggingface.co/madbuda/triton-windows-builds/tree/main You can download one of them and install

The varlen version for sage was added later, so you probably need to update sageattention itself.

@4lt3r3go
Copy link

4lt3r3go commented Dec 4, 2024

sdpa working for me but as you said no movement just pixelated movements

i can confirm what Kijai sayd. Sdpa produce really subtle movements.
to avoid pixelation you need high steps. I've got pixelation at 8 to 20 steps,
after 20 steps pixelation sort of disappear in some cases

@4lt3r3go
Copy link

4lt3r3go commented Dec 4, 2024

The varlen version for sage was added later, so you probably need to update sageattention itself.

ok pasting here in case other users looking for same solution:
for comfy portable:
F:\Your_Comfy_Directory\python_embeded\python.exe -m pip install --upgrade sageattention

this solved. Now works. Thanks Kijai🤍

@knyeoh
Copy link

knyeoh commented Dec 4, 2024

Is this pixilation?

HunyuanVideo_00008.mp4

Here is my setting:

image

@ghostorchidgaming
Copy link

Did that and now getting this error. RuntimeError: Failed to find C compiler. Please specify via CC environment variable.

If you are on Windows and using the Portable version of ComfyUI then there is a critical step explained on the triton-windows github under:
Special notes if you're using ComfyUI with the embeded Python:
https://github.com/woct0rdho/triton-windows

That was the last piece of the puzzle for me.

@kijai
Copy link
Owner

kijai commented Dec 6, 2024

Might've finally figured it out, at least I can now use sdpa:

AnimateDiff_00002.63.mp4

@Smiden3
Copy link

Smiden3 commented Dec 6, 2024

Возможно, я наконец-то понял это, по крайней мере, теперь я могу использовать sdpa:

AnimateDiff_00002.63.mp4

how was that possible?

@kijai kijai closed this as completed Dec 8, 2024
kijai pushed a commit that referenced this issue Dec 16, 2024
* TextImage Encoder now a seperate node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants