abdeladim-s / subsai

🎞️ Subtitles generation tool (Web-UI + CLI + Python package) powered by OpenAI's Whisper and its variants 🎞️
https://abdeladim-s.github.io/subsai/
GNU General Public License v3.0
1.31k stars 107 forks source link

Warnings at startup (torchaudio, soundfile, sox_io, torchvision, streamlit), FileNotFoundError on running #100

Closed Nu70ry closed 10 months ago

Nu70ry commented 10 months ago

At startup i get multiple warnings.

[07:53:15] WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is not supported on Windows. torch_audio_backend.py:19
           WARNING  torchvision is not available - cannot save figures train_logger.py:264
           WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is not supported on Windows. torch_audio_backend.py:19
2024-01-12 07:53:16.241 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager`

when i input the path to a video file, i get this warning:

Warning: temperature does not have a supported UI

if i try to run the program on the video file i get these errors:

2024-01-12 08:52:07.233 Uncaught app exception
Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get
    entry_bytes = self._read_from_mem_cache(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache
    raise CacheStorageKeyNotFoundError("Key not found in mem cache")
streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result
    pickled_entry = self.storage.get(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get
    entry_bytes = self._persist_storage.get(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get
    raise CacheStorageKeyNotFoundError(
streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

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

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 245, in _get_or_create_cached_value
    cached_result = cache.read_result(value_key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result
    raise CacheKeyNotFoundError(str(e)) from e
streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get
    entry_bytes = self._read_from_mem_cache(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache
    raise CacheStorageKeyNotFoundError("Key not found in mem cache")
streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result
    pickled_entry = self.storage.get(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get
    entry_bytes = self._persist_storage.get(key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get
    raise CacheStorageKeyNotFoundError(
streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

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

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 293, in _handle_cache_miss
    cached_result = cache.read_result(value_key)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result
    raise CacheKeyNotFoundError(str(e)) from e
streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 555, in <module>
    run()
  File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 548, in run
    webui()
  File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 318, in webui
    subs = _transcribe(file_path, stt_model_name, model_config)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 194, in wrapper
    return cached_func(*args, **kwargs)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 223, in __call__
    return self._get_or_create_cached_value(args, kwargs)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 248, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
  File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 302, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
  File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 190, in _transcribe
    subs = subs_ai.transcribe(media_file=file_path, model=model)
  File "C:\Program Files\Python\Python310\lib\site-packages\subsai\main.py", line 115, in transcribe
    return stt_model.transcribe(media_file)
  File "C:\Program Files\Python\Python310\lib\site-packages\subsai\models\whisper_model.py", line 207, in transcribe
    audio = whisper.load_audio(media_file)
  File "C:\Program Files\Python\Python310\lib\site-packages\whisper\audio.py", line 58, in load_audio
    out = run(cmd, capture_output=True, check=True).stdout
  File "C:\Program Files\Python\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\Python\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

all of the above were copied from console here is what webui inside the browser gives out:

FileNotFoundError: [WinError 2] The system cannot find the file specified
Traceback:
File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 555, in <module>
    run()
File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 548, in run
    webui()
File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 318, in webui
    subs = _transcribe(file_path, stt_model_name, model_config)
File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 194, in wrapper
    return cached_func(*args, **kwargs)
File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 223, in __call__
    return self._get_or_create_cached_value(args, kwargs)
File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 248, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "C:\Program Files\Python\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 302, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
File "C:\Program Files\Python\Python310\Lib\site-packages\subsai\webui.py", line 190, in _transcribe
    subs = subs_ai.transcribe(media_file=file_path, model=model)
File "C:\Program Files\Python\Python310\lib\site-packages\subsai\main.py", line 115, in transcribe
    return stt_model.transcribe(media_file)
File "C:\Program Files\Python\Python310\lib\site-packages\subsai\models\whisper_model.py", line 207, in transcribe
    audio = whisper.load_audio(media_file)
File "C:\Program Files\Python\Python310\lib\site-packages\whisper\audio.py", line 58, in load_audio
    out = run(cmd, capture_output=True, check=True).stdout
File "C:\Program Files\Python\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
File "C:\Program Files\Python\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

some additional infos about my system:

Windows 11 Python 3.10.6

installed packages:

Package                   Version
------------------------- ------------
aiohttp                   3.9.1
aiosignal                 1.3.1
alembic                   1.13.1
altair                    4.2.2
antlr4-python3-runtime    4.9.3
asteroid-filterbanks      0.4.0
async-timeout             4.0.3
attrs                     23.2.0
audioread                 3.0.1
auditok                   0.1.5
av                        10.0.0
blinker                   1.7.0
cachetools                5.3.2
certifi                   2023.11.17
cffi                      1.16.0
chardet                   5.2.0
charset-normalizer        3.3.2
click                     8.1.7
colorama                  0.4.6
coloredlogs               15.0.1
colorlog                  6.8.0
contourpy                 1.2.0
ctranslate2               3.24.0
cycler                    0.12.1
Cython                    3.0.8
decorator                 5.1.1
dl-translate              0.3.0
docopt                    0.6.2
dtw-python                1.3.1
einops                    0.7.0
entrypoints               0.4
faster-whisper            0.10.0
faust-cchardet            2.1.19
ffmpeg                    1.4
ffmpeg-python             0.2.0
ffsubsync                 0.4.25
filelock                  3.13.1
flatbuffers               23.5.26
fonttools                 4.47.2
frozenlist                1.4.1
fsspec                    2023.12.2
future                    0.18.3
gitdb                     4.0.11
GitPython                 3.1.41
greenlet                  3.0.3
huggingface-hub           0.20.2
humanfriendly             10.0
HyperPyYAML               1.2.2
idna                      3.6
importlib-metadata        7.0.1
Jinja2                    3.1.3
joblib                    1.3.2
jsonschema                4.20.0
jsonschema-specifications 2023.12.1
julius                    0.2.7
kiwisolver                1.4.5
lazy_loader               0.3
librosa                   0.10.1
lightning                 2.1.3
lightning-utilities       0.10.0
llvmlite                  0.41.1
Mako                      1.3.0
markdown-it-py            3.0.0
MarkupSafe                2.1.3
matplotlib                3.8.2
mdurl                     0.1.2
more-itertools            10.2.0
mpmath                    1.3.0
msgpack                   1.0.7
multidict                 6.0.4
networkx                  3.2.1
nltk                      3.8.1
numba                     0.58.1
numpy                     1.26.3
omegaconf                 2.3.0
onnxruntime               1.16.3
openai-whisper            20231106
optuna                    3.5.0
packaging                 23.2
pandas                    1.5.3
pillow                    10.2.0
pip                       23.3.2
platformdirs              4.1.0
pooch                     1.8.0
primePy                   1.3
protobuf                  3.20.3
pyannote.audio            2.1.1
pyannote.core             5.0.0
pyannote.database         5.0.1
pyannote.metrics          3.2.1
pyannote.pipeline         3.0.1
pyarrow                   14.0.2
pycparser                 2.21
pydeck                    0.8.1b0
pydub                     0.25.1
Pygments                  2.17.2
Pympler                   1.0.1
pyparsing                 3.1.1
pyreadline3               3.4.1
pysubs2                   1.6.1
python-dateutil           2.8.2
python-decouple           3.8
pytorch-lightning         2.1.3
pytorch-metric-learning   2.4.1
pytz                      2023.3.post1
pywhispercpp              1.1.1
PyYAML                    6.0.1
referencing               0.32.1
regex                     2023.12.25
requests                  2.31.0
rich                      13.7.0
rpds-py                   0.16.2
ruamel.yaml               0.18.5
ruamel.yaml.clib          0.2.8
safetensors               0.4.1
scikit-learn              1.3.2
scipy                     1.11.4
semver                    3.0.2
sentencepiece             0.1.99
setuptools                69.0.3
shellingham               1.5.4
six                       1.16.0
smmap                     5.0.1
sortedcontainers          2.4.0
soundfile                 0.12.1
soxr                      0.3.7
speechbrain               0.5.16
SQLAlchemy                2.0.25
srt                       3.5.3
streamlit                 1.20.0
streamlit-aggrid          0.3.4.post3
streamlit-player          0.1.5
subsai                    1.2.4
sympy                     1.12
tabulate                  0.9.0
tensorboardX              2.6.2.2
threadpoolctl             3.2.0
tiktoken                  0.5.2
tokenizers                0.15.0
toml                      0.10.2
toolz                     0.12.0
torch                     2.0.1
torch-audiomentations     0.11.0
torch-pitch-shift         1.2.4
torchaudio                2.0.2
torchmetrics              1.3.0
tornado                   6.4
tqdm                      4.66.1
transformers              4.36.2
typer                     0.9.0
typing_extensions         4.9.0
tzdata                    2023.4
tzlocal                   5.2
urllib3                   2.1.0
validators                0.22.0
watchdog                  3.0.0
webrtcvad-wheels          2.0.11.post1
whisper-timestamped       1.14.3
whisperx                  3.1.1
yarl                      1.9.4
zipp                      3.17.0

edit: solved first problem with fresh reinstall of python, updated with new error.

abdeladim-s commented 10 months ago

Is ffmpeg installed correctly on your system (as described in the readme file) Try for example ffmpeg -v in your terminal and see if it works ?

Nu70ry commented 10 months ago

seems that ffmpeg is indeed missing i did it with "pip install ffmpeg" since i do prefer to not clutter my system with lots of programs. but i now installed it with chocolatey and it works, thank you !

But now i cannot save the video merged with the subtitles, i can save the subtitles on its own tho. i get this error if i try to save the video merged with subtitles:

(console)

ffmpeg version 6.1.1-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'B:\Video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.45.100
    artist          : Converted Video
    album_artist    : Converted Video
    title           : Video
  Duration: 00:01:06.12, start: 0.000000, bitrate: 4501 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4359 kb/s, 60 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Input #1, srt, from 'C:\Users\battr\AppData\Local\Temp\tmpk3g7jb2b.srt':
  Duration: N/A, bitrate: N/A
  Stream #1:0: Subtitle: subrip
[sost#0:2 @ 000001bed060efc0] Automatic encoder selection failed Default encoder for format mp4 (codec none) is probably disabled. Please choose an encoder manually.
[sost#0:2 @ 000001bed060efc0] Error selecting an encoder
Error opening output file B:\Video-subs-merged.mp4.
Error opening output files: Encoder not found
ffmpeg error (see stderr output for detail)

webui only says something went wrong and points me to the console.

Also, are these warnings at startup expect to happen and can be ignored? or will they cause some trouble at some point?

[08:02:04] WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is not supported on Windows. torch_audio_backend.py:19
           WARNING  torchvision is not available - cannot save figures train_logger.py:264
           WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is not supported on Windows. torch_audio_backend.py:19
2024-01-13 08:02:05.266 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager

Thank you for your fast responses, its much appreciated.

abdeladim-s commented 10 months ago

From the error, ffmpeg says that the codec needed for this video is not installed or missing, what type of video format are you using ? If you can share it I will give it a try on my end ? Also, I would suggest trying the docker image, you will get a container with everything installed, besides you won't clutter your entire system with third party software as well.

Nu70ry commented 10 months ago

The video file was indeed corrupt, i tried another one and it worked. Thank you for your help.