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.16k stars 96 forks source link

Streamlit memory error #45

Open ducminh1712 opened 11 months ago

ducminh1712 commented 11 months ago

After inputting the media path, hitting Enter on the web ui, the memory usage is through the roof. And it crashed. Here is the full error showing in console.

(subsai) D:\Workspace>subsai-webui
[17:46:06] WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is   torch_audio_backend.py:19
                    not supported on Windows.
[17:46:46] WARNING  The torchaudio backend is switched to 'soundfile'. Note that 'sox_io' is   torch_audio_backend.py:19
                    not supported on Windows.
2023-07-11 17:46:47.647 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://192.168.31.61:8501

Warning: temperature does not have a supported UI
Warning: temperature does not have a supported UI
2023-07-11 17:48:36.401 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit\components\v1\components.py", line 151, in create_instance
    serialized_json_args = json.dumps(json_args)
                           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\json\encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\json\encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\subsai\webui.py", line 501, in <module>
    run()
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\subsai\webui.py", line 494, in run
    webui()
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\subsai\webui.py", line 470, in webui
    event = st_player(_media_file_base64(file_path), **options, height=500, key="player")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit_player\__init__.py", line 84, in st_player
    event = _component_func(
            ^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit\components\v1\components.py", line 79, in __call__
    return self.create_instance(*args, default=default, key=key, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit\runtime\metrics_util.py", line 311, in wrapped_func
    result = non_optional_func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minh\.conda\envs\subsai\Lib\site-packages\streamlit\components\v1\components.py", line 153, in create_instance
    raise MarshallComponentException(
streamlit.components.v1.components.MarshallComponentException: ('Could not convert component args to JSON', MemoryError())
abdeladim-s commented 11 months ago

@ducminh1712,

From what I can see, the cause of the error is the st_player component!

Are you using a huge media file by any chance ? Can you try with a small media file ?

ducminh1712 commented 11 months ago

Yes, it was a big media file. Would the CLI be a workaround for this at least for now? If it is, would be great if a --verbose option could be added to track the progress.

abdeladim-s commented 11 months ago

Hope this helps!