其中这个答案并没有解决我的问题:
import flash_attn_2_cuda as flash_attn_cuda
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /mnt/nas/kexin/cv/Open-Sora/xformers/third_party/flash-attention/flash_attn_2_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC2ENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
import的flash_attn是xformers的包。。。
cd到目录下 /mnt/nas/kexin/cv/Open-Sora/xformers/third_party/flash-attention/flash_attn_2_cuda.cpython-310-x86_64-linux-gnu.so。
重新安装xformers
报错:
Could not build wheels for xformers, which is required to install pyproject.toml-based projects
pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121