JarodMica / audiosplitter_whisper

MIT License
93 stars 36 forks source link

Erorr when I tried on Google Colab #10

Closed ken021109 closed 1 year ago

ken021109 commented 1 year ago

Fist I Clone the repository with command

git clone https://github.com/JarodMica/audiosplitter_whisper.git

Second, I run this command:

%cd /content/audiosplitter_whisper
!sudo apt update && sudo apt upgrade
!sudo apt-get update
!sudo apt install ffmpeg
!sudo apt install python3.10-venv

Then, I run setup-cuda.py Next, I run this command to run split_audio.py:

%cd /content/audiosplitter_whisper
!source /content/audiosplitter_whisper/venv/bin/activate; python3 /content/audiosplitter_whisper/split_audio.py

And the error appeared:

Traceback (most recent call last):
  File "/content/audiosplitter_whisper/venv/bin/whisperx", line 33, in <module>
    sys.exit(load_entry_point('whisperx==3.1.1', 'console_scripts', 'whisperx')())
  File "/content/audiosplitter_whisper/venv/bin/whisperx", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/whisperx/__init__.py", line 1, in <module>
    from .transcribe import load_model
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/whisperx/transcribe.py", line 9, in <module>
    from .alignment import align, load_align_model
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/whisperx/alignment.py", line 11, in <module>
    import torchaudio
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/torchaudio/__init__.py", line 1, in <module>
    from torchaudio import (  # noqa: F401
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/torchaudio/_extension/__init__.py", line 43, in <module>
    _load_lib("libtorchaudio")
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 61, in _load_lib
    torch.ops.load_library(path)
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/torch/_ops.py", line 643, in load_library
    ctypes.CDLL(path)
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libtorch_hip.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/content/audiosplitter_whisper/split_audio.py", line 189, in <module>
    process_audio_files(input_folder)
  File "/content/audiosplitter_whisper/split_audio.py", line 185, in process_audio_files
    extract_audio_with_srt(audio_file_path, srt_file, speaker_segments_dir)
  File "/content/audiosplitter_whisper/split_audio.py", line 101, in extract_audio_with_srt
    subs = pysrt.open(srt_file)
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/pysrt/srtfile.py", line 151, in open
    source_file, encoding = cls._open_unicode_file(path, claimed_encoding=encoding)
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/pysrt/srtfile.py", line 292, in _open_unicode_file
    encoding = claimed_encoding or cls._detect_encoding(path)
  File "/content/audiosplitter_whisper/venv/lib/python3.10/site-packages/pysrt/srtfile.py", line 279, in _detect_encoding
    file_descriptor = open(path, 'rb')
IsADirectoryError: [Errno 21] Is a directory: '/content/audiosplitter_whisper/data/output/model'

Also, has anyone tried it on Google Colab?

Latrolage commented 1 year ago

Try, pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --upgrade instead of installing the torch versions that requirements.txt has

JarodMica commented 1 year ago

I'm not familiar with how to get this set-up on collab and don't have the time to fiddle around with it too much, but it should work as any other device. Try what Latrolage said and let us know.

filispeen commented 1 year ago

Also try my fork https://github.com/filispeen/audiosplitter_whisper_headless