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

Fix neg_threshold #1191

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix neg_threshold #1191

wants to merge 3 commits into from

Conversation

Purfview
Copy link
Contributor

@Purfview Purfview commented Dec 6, 2024

Fix neg_threshold.
Now it should work properly, before its default was hardcoded to 0.35

@Purfview Purfview changed the title Prevents neg_threshold going negative Fix neg_threshold Dec 7, 2024
@MahmoudAshraf97
Copy link
Collaborator

MahmoudAshraf97 commented Dec 11, 2024

the default was 0.35 indeed but it's not hardcoded and can changed when initializing VadOptions
a simpler solution would be

    threshold: float = 0.5
-    neg_threshold: float = threshold - 0.15
+    neg_threshold: float = max(threshold - 0.15, 0)
    min_speech_duration_ms: int = 0
    max_speech_duration_s: float = float("inf")
    min_silence_duration_ms: int = 2000
    speech_pad_ms: int = 400

this would remove the need for other changes as it will not be None and if it's set explicitly to a negative it will behave as zero, so no need to handle this

edit: and since there is no issue if it is a negative value, then even the solution above is not needed, it will be merely cosmetic

@Purfview
Copy link
Contributor Author

Purfview commented Dec 11, 2024

but it's not hardcoded

vad_parameters = {}
vad_parameters['threshold'] = 0.2

model.transcribe(fileaudio, vad_filter=True, vad_parameters=vad_parameters)

# prints below this line https://github.com/SYSTRAN/faster-whisper/blob/f32c0e8af3f2843bf70071d3d14a480a6a23da66/faster_whisper/vad.py#L93
# vad.py_print threshold: 0.2
# vad.py_print neg_threshold: 0.35   <- hardcoded, should be 0.05

since there is no issue if it is a negative value, then even the solution above is not needed, it will be merely cosmetic

Yeah, I didn't looked if there is an issue, just that it's that way in the original silero [it's not zero] -> repo

@abedkhooli
Copy link

I can't set the threshold itself in v 1.1.0 (and can't read it from vad.VadOptions).

@Purfview
Copy link
Contributor Author

I can't set the threshold itself in v 1.1.0 (and can't read it from vad.VadOptions).

Look there: #1181

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

Successfully merging this pull request may close these issues.

3 participants