Flash attention issue with python 3.13

#7
by freakynit - opened
  File "/workspace/codes/app.py", line 110, in <module>
    model = AutoModel.from_pretrained(
        model_name,
    ...<2 lines>...
        use_safetensors=True
    )
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/models/auto/auto_factory.py", line 526, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        pretrained_model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/models/auto/configuration_auto.py", line 1026, in from_pretrained
    config_class = get_class_from_dynamic_module(
        class_ref, pretrained_model_name_or_path, code_revision=code_revision, **kwargs
    )
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/dynamic_module_utils.py", line 552, in get_class_from_dynamic_module
    return get_class_in_module(class_name, final_module, force_reload=force_download)
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/dynamic_module_utils.py", line 249, in get_class_in_module
    module_spec.loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1027, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/root/.cache/huggingface/modules/transformers_modules/deepseek-ai/DeepSeek-OCR/59512895521e669adb87064b37e5749fe9b9f5d2/modeling_deepseekocr.py", line 1, in <module>
    from .modeling_deepseekv2 import DeepseekV2Model, DeepseekV2ForCausalLM
  File "/root/.cache/huggingface/modules/transformers_modules/deepseek-ai/DeepSeek-OCR/59512895521e669adb87064b37e5749fe9b9f5d2/modeling_deepseekv2.py", line 37, in <module>
    from transformers.models.llama.modeling_llama import (
    ...<2 lines>...
    )
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/models/llama/modeling_llama.py", line 32, in <module>
    from ...modeling_flash_attention_utils import _flash_attention_forward
  File "/root/.venvs/py313/lib/python3.13/site-packages/transformers/modeling_flash_attention_utils.py", line 27, in <module>
    from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venvs/py313/lib/python3.13/site-packages/flash_attn/__init__.py", line 3, in <module>
    from flash_attn.flash_attn_interface import (
    ...<7 lines>...
    )
  File "/root/.venvs/py313/lib/python3.13/site-packages/flash_attn/flash_attn_interface.py", line 15, in <module>
    import flash_attn_2_cuda as flash_attn_gpu
ImportError: /root/.venvs/py313/lib/python3.13/site-packages/flash_attn_2_cuda.cpython-313-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC2ENS_14SourceLocationESs

you might try compile from src code for this package

this is not a deepseek repo bug. dud

Sign up or log in to comment