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

Apple M1 FileNotFoundError #120

Closed leleneb closed 8 months ago

leleneb commented 8 months ago

Hello, first of all thanks for your work !

I am on mac M1 (ventura) I install subsai with docker. For that I had to edit the docker-compose.yml to remove the nvidia gpu part because otherwise I had an error "could not select device driver "" with capabilities : [[gpu]]."

Now the webui starts without any problem but when I want to transcribe a file, I always get this error message:

When a load the file: FileNotFoundError: [Errno 2] No such file or directory: '/Users/graph/Desktop/TEST/input.mp4' Traceback: File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "/subsai/src/subsai/webui.py", line 573, in <module> run() File "/subsai/src/subsai/webui.py", line 566, in run webui() File "/subsai/src/subsai/webui.py", line 505, in webui if os.path.getsize(file_path) > st.web.server.server.get_max_message_size_bytes(): File "/opt/conda/lib/python3.10/genericpath.py", line 50, in getsize return os.stat(filename).st_size

When I try to run a transcripte anyway:

FileNotFoundError: /Users/graph/Desktop/TEST/input.mp4 Traceback: File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "/subsai/src/subsai/webui.py", line 573, in <module> run() File "/subsai/src/subsai/webui.py", line 566, in run webui() File "/subsai/src/subsai/webui.py", line 330, in webui subs = _transcribe(file_path, stt_model_name, model_config) File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 194, in wrapper return cached_func(*args, **kwargs) File "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 223, in __call__ return self._get_or_create_cached_value(args, kwargs) File "/opt/conda/lib/python3.10/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 "/opt/conda/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 302, in _handle_cache_miss computed_value = self._info.func(*func_args, **func_kwargs) File "/subsai/src/subsai/webui.py", line 191, in _transcribe subs = subs_ai.transcribe(media_file=file_path, model=model) File "/opt/conda/lib/python3.10/site-packages/subsai/main.py", line 115, in transcribe return stt_model.transcribe(media_file) File "/opt/conda/lib/python3.10/site-packages/subsai/models/whispercpp_model.py", line 247, in transcribe segments = self.model.transcribe(media=media_file) File "/opt/conda/lib/python3.10/site-packages/pywhispercpp/model.py", line 118, in transcribe raise FileNotFoundError(media)

I think I'm missing something. Thanks for the help

abdeladim-s commented 8 months ago

You are welcome @leleneb. `Glad you found it useful.

I didn't know the gpu part on the docker file will raise an error if you there is no compatible GPU, I will try to find a workaround. Thanks for pointing that out.

Regarding the error, I think you are missing the volume mapping part of the command, the docker container is like a separate virtual machine, it does not have access to the host file system. Please use the command as described in the README:

docker compose run -p 8501:8501 -v /path/to/your/media_files/folder:/media_files subsai-webui

Where /path/to/your/media_files/folder is a folder you want the docker container to have access to and /media_files is the folder name in the container.

You can then access your files from within the container with /media_file/your_file.

Please give this a try and let me know if you are still getting the error ?

leleneb commented 8 months ago

Hello,

you were right I was missing the first "/" in my path. with /media_file/your_file it works great !

Regards