Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anyway to force language in case of wrong whisper autodetection? #47

Closed
ndx1905-github opened this issue Feb 8, 2024 · 9 comments
Closed

Comments

@ndx1905-github
Copy link

ndx1905-github commented Feb 8, 2024

Hi

Thanks for the great work and very useful tool (I'm amazed that it works on my 2018 NAS)

Faster whisper sometimes picks the wrong language..
Is there a way to force the language?

Here is an example, it's French audio wrongly detected as English (score of .56)

image

I should pass the --language fr to faster-whisper. One way could probably be to add "FR" somewhere at the end of the file name right before the file extension?
openai/whisper#529

@McCloudS
Copy link
Owner

McCloudS commented Feb 8, 2024 via email

@McCloudS
Copy link
Owner

McCloudS commented Feb 8, 2024

Take a look at the readme @ FORCE_DETECTED_LANGUAGE_TO and try to re-pull the image. Let me know if it works!

@ndx1905-github
Copy link
Author

ndx1905-github commented Feb 9, 2024

Hey.. it didn't change anything. Here is the screenshot after adding the FORCE_DETECTED_LANGUAGE_TO variable and rebooting the docker.

image

However... I watched the video and subtitles still worked. I'm not sure what this "detected language" notification does in practice since the output was correct. Log says "English" detected, but in practice I still have the right "French to English" srt that is generated.

(EDIT: to be more precise, subtitles were correct even before the patch, and despite the wrong language detection)

@McCloudS
Copy link
Owner

McCloudS commented Feb 9, 2024

Good to know that even with the misdetected language, it produces something passable. Did you actually pull the new docker image instead of just restarting it?

@ndx1905-github
Copy link
Author

Yes I redownloaded the image. Just did it again, same result. Still detects English.
But does the --language option change the language that is detected, or does it still detect English, writes that in the console and then the --language option forces faster-whisper to use FR even though EN was detected ?

@McCloudS
Copy link
Owner

McCloudS commented Feb 9, 2024

It's passed the way that stable-ts and faster-whisper document. And per https://github.com/SYSTRAN/faster-whisper/blob/f144e4c83d54f3c3304b6a75a3f563e5f84de6cf/faster_whisper/transcribe.py#L344 it shows that if a language is manually defined it shouldn't try to detect the language unless it's an English only model. Any chance you're using the .en models? Like medium.en instead of medium.

@ndx1905-github
Copy link
Author

yes I'm sure I've selected medium, not medium.en
Also medium.en would probably produce garbage? but my output is still good

@McCloudS
Copy link
Owner

McCloudS commented Feb 9, 2024

I'm a little puzzled as to why it's ignoring the language. I'll play with it later if I have time, but it's comforting to know that it may not actually matter?

@McCloudS
Copy link
Owner

This is now fixed and I confirmed it will show as the correct forced language. You can also navigate to http://subgenip:8090/docs in a browser and use the Batch option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants