Skip to content

Commit

Permalink
improved error message when extension is compiled against a different…
Browse files Browse the repository at this point in the history
… torch version than the one installed
  • Loading branch information
MahmoudAshraf97 committed May 22, 2024
1 parent c39f6e1 commit 6d4a448
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ctc_forced_aligner/alignment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@
__version__ as transformers_version,
)
from transformers.utils import is_flash_attn_2_available
from .ctc_forced_aligner import forced_align as forced_align_cpp

try:
from .ctc_forced_aligner import forced_align as forced_align_cpp
except Exception as e:
if all(
substring in e.__repr__()
for substring in ["ctc_forced_aligner", "undefined symbol"]
):
raise ImportError(
"ctc-forced-aligner package was build using a different version of "
"torch than the one currently installed, reinstall the package again using: \n"
"pip install git+https://github.com/MahmoudAshraf97/ctc-forced-aligner.git --force-reinstall --no-deps"
)
else:
raise e

from typing import Optional, Tuple
from packaging import version

Expand Down

0 comments on commit 6d4a448

Please sign in to comment.