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

我在执行test的时候报错ImportError: DLL load failed while importing flash_attn_2_cuda: 找不到指定的程序。 #233

Open
120805481 opened this issue Dec 12, 2024 · 1 comment

Comments

@120805481
Copy link

D:\ProgramData\anaconda3\envs\RealtimeTTS2\python.exe D:\BaiduNetdiskDownload\RealtimeTTS\tests\coqui_test.py
Traceback (most recent call last):
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\utils\import_utils.py", line 1778, in get_module
return importlib.import_module("." + module_name, self.name)
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\models\gpt2\modeling_gpt2.py", line 58, in
from ...modeling_flash_attention_utils import flash_attention_forward
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\modeling_flash_attention_utils.py", line 27, in
from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\flash_attn_init
.py", line 3, in
from flash_attn.flash_attn_interface import (
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\flash_attn\flash_attn_interface.py", line 10, in
import flash_attn_2_cuda as flash_attn_cuda
ImportError: DLL load failed while importing flash_attn_2_cuda: 找不到指定的程序。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\BaiduNetdiskDownload\RealtimeTTS\tests\coqui_test.py", line 2, in
from RealtimeTTS import TextToAudioStream, CoquiEngine
File "D:\BaiduNetdiskDownload\RealtimeTTS\RealtimeTTS_init_.py", line 1, in
from .text_to_stream import TextToAudioStream # noqa: F401
File "D:\BaiduNetdiskDownload\RealtimeTTS\RealtimeTTS\text_to_stream.py", line 4, in
from .engines import BaseEngine
File "D:\BaiduNetdiskDownload\RealtimeTTS\RealtimeTTS\engines_init_.py", line 24, in
from TTS.utils.manage import ModelManager
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\TTS_init_.py", line 16, in
from TTS.tts.configs.xtts_config import XttsConfig
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\TTS\tts\configs\xtts_config.py", line 5, in
from TTS.tts.models.xtts import XttsArgs, XttsAudioConfig
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\TTS\tts\models\xtts.py", line 13, in
from TTS.tts.layers.xtts.gpt import GPT
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\TTS\tts\layers\xtts\gpt.py", line 10, in
from TTS.tts.layers.tortoise.autoregressive import (
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\TTS\tts\layers\tortoise\autoregressive.py", line 11, in
from transformers import GPT2Config, GPT2PreTrainedModel, LogitsProcessorList
File "", line 1075, in _handle_fromlist
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\utils\import_utils.py", line 1767, in getattr
value = getattr(module, name)
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\utils\import_utils.py", line 1766, in getattr
module = self._get_module(self._class_to_module[name])
File "D:\ProgramData\anaconda3\envs\RealtimeTTS2\lib\site-packages\transformers\utils\import_utils.py", line 1780, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.gpt2.modeling_gpt2 because of the following error (look up to see its traceback):
DLL load failed while importing flash_attn_2_cuda: 找不到指定的程序。

Process finished with exit code 1 这个怎么解决。感谢

@KoljaB
Copy link
Owner

KoljaB commented Dec 12, 2024

Looks like something's wrong around the CUDA installation, hard to say what.

Is CUDA Tookit installed? Please verify that environment variables CUDA_PATH and CUDA_HOME are set to the correct CUDA installation folder, for example:

set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"

Maybe cudart64_12.dll can't be found and needs to be put in a folder that's in PATH env. Maybe just uninstalling flash attn works ("pip3 uninstall flash-attn").

Could also be wrong python version (coqui tts requires Python >= 3.9, < 3.13).

If nothing works please try to install in a fresh virtual environment to see if that issue persists.

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

2 participants