comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
50.86k stars 5.34k forks source link

flash_attn_cuda import error #4614

Open Shirley626 opened 3 weeks ago

Shirley626 commented 3 weeks ago

Your question

I pulled the latest ComfyUI code and installed the required libraries using pip install -r requirements, but I'm still encountering this issue.

  File "/usr/local/lib/python3.10/dist-packages/kornia/augmentation/_3d/mix/transplantation.py", line 1, in <module>
    from kornia.augmentation._2d.mix.transplantation import RandomTransplantation
  File "/usr/local/lib/python3.10/dist-packages/kornia/augmentation/_2d/__init__.py", line 2, in <module>
    from kornia.augmentation._2d.intensity import *
  File "/usr/local/lib/python3.10/dist-packages/kornia/augmentation/_2d/intensity/__init__.py", line 29, in <module>
    from kornia.augmentation._2d.intensity.plasma import RandomPlasmaBrightness, RandomPlasmaContrast, RandomPlasmaShadow
  File "/usr/local/lib/python3.10/dist-packages/kornia/augmentation/_2d/intensity/plasma.py", line 5, in <module>
    from kornia.contrib import diamond_square
  File "/usr/local/lib/python3.10/dist-packages/kornia/contrib/__init__.py", line 15, in <module>
    from .image_stitching import ImageStitcher
  File "/usr/local/lib/python3.10/dist-packages/kornia/contrib/image_stitching.py", line 7, in <module>
    from kornia.feature import LocalFeatureMatcher, LoFTR
  File "/usr/local/lib/python3.10/dist-packages/kornia/feature/__init__.py", line 7, in <module>
    from .integrated import (
  File "/usr/local/lib/python3.10/dist-packages/kornia/feature/integrated.py", line 17, in <module>
    from .lightglue import LightGlue
  File "/usr/local/lib/python3.10/dist-packages/kornia/feature/lightglue.py", line 30, in <module>
    from flash_attn.modules.mha import FlashCrossAttention
  File "/usr/local/lib/python3.10/dist-packages/flash_attn/__init__.py", line 3, in <module>
    from flash_attn.flash_attn_interface import flash_attn_func
  File "/usr/local/lib/python3.10/dist-packages/flash_attn/flash_attn_interface.py", line 4, in <module>
    import flash_attn_2_cuda as flash_attn_cuda
ImportError: /usr/local/lib/python3.10/dist-packages/flash_attn_2_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda9SetDeviceEi

Logs

No response

Other

No response

ifTureReturnTure commented 1 week ago

+1

NeedsMoar commented 1 day ago

Kornia requires flash attention 2 but doesn't list it in its requirements.txt because they're apparently idiots so there's no way of even knowing what version it wants because the flash_attn_2 author is also an idiot (at least in that regard) and doesn't include a package version string in his filename but breaks stuff all the time. I found through trial and error that v2.6.3 works with it. There's probably a wheel for linux, if you're on Windows it needs to be built against your python version.