SYSTRAN / faster-whisper

Faster Whisper transcription with CTranslate2
MIT License
11.84k stars 988 forks source link

ValueError exception when no language is detected #900

Open dodysw opened 3 months ago

dodysw commented 3 months ago

732 causes this exception when language is not detected.

    language = max(                       
ValueError: max() arg is an empty sequence

on

                    language = max(
                        detected_language_info,
                        key=lambda lang: len(detected_language_info[lang]),
                    )

since detected_language_info is an empty dict.

dodysw commented 3 months ago

Sample fix https://github.com/dodysw/faster-whisper/commit/126abe33ce729a7edc11af9944173fc2b7444798

Papierkorb commented 1 month ago

Hey @dodysw, are you planning on upstreaming your changes?

I was getting the error you've documented in faster-whisper-server.

For Google-ability, if someone else stumbles upon the same issue, here's how you can use dodys fork in faster-whisper-server:

  1. Clone the faster-whisper-server repository, if not done already.
  2. Modify its requirements.txt: Look for the line faster-whisper==... and replace it with this: git+https://github.com/dodysw/faster-whisper.git@master-dody
  3. Modify Dockerfile.cuda (in my case) and add git to the apt-get call on top.
  4. Build the container, like docker compose build

I'm aware that this fix is neither fully correct, nor are we here in the correct repository. Yet I figured I might as well document it and then go on from there. 😅

dodysw commented 1 month ago

Hey @dodysw, are you planning on upstreaming your changes?

Thanks for the interest :D No plan yet, due to time commitment. Please copy paste it as you like. Also I'll wait until faster-whisper upstream repo a little bit slower changed.