jhj0517 commited on
Commit
aa98cf2
·
1 Parent(s): 6db9d8d

Fix param validation

Browse files
Files changed (1) hide show
  1. modules/whisper/whisper_base.py +3 -7
modules/whisper/whisper_base.py CHANGED
@@ -15,7 +15,7 @@ from dataclasses import astuple
15
  from modules.uvr.music_separator import MusicSeparator
16
  from modules.utils.paths import (WHISPER_MODELS_DIR, DIARIZATION_MODELS_DIR, OUTPUT_DIR, DEFAULT_PARAMETERS_CONFIG_PATH,
17
  UVR_MODELS_DIR)
18
- from modules.utils.constants import AUTOMATIC_DETECTION, GRADIO_NONE_VALUES
19
  from modules.utils.subtitle_manager import get_srt, get_vtt, get_txt, write_file, safe_filename
20
  from modules.utils.youtube_manager import get_ytdata, get_ytaudio
21
  from modules.utils.files_manager import get_media_files, format_gradio_files, load_yaml, save_yaml
@@ -127,10 +127,6 @@ class WhisperBase(ABC):
127
  self.music_separator.offload()
128
 
129
  if vad_params.vad_filter:
130
- # Explicit value set for float('inf') from gr.Number()
131
- if vad_params.max_speech_duration_s is None or vad_params.max_speech_duration_s >= 9999:
132
- vad_params.max_speech_duration_s = float('inf')
133
-
134
  vad_options = VadOptions(
135
  threshold=vad_params.threshold,
136
  min_speech_duration_ms=vad_params.min_speech_duration_ms,
@@ -535,8 +531,8 @@ class WhisperBase(ABC):
535
  params.whisper.hallucination_silence_threshold = None
536
  if params.whisper.language_detection_threshold == 0:
537
  params.whisper.language_detection_threshold = None
538
- if params.whisper.max_speech_duration_s >= 9999:
539
- params.whisper.max_speech_duration_s = float('inf')
540
  return params
541
 
542
  @staticmethod
 
15
  from modules.uvr.music_separator import MusicSeparator
16
  from modules.utils.paths import (WHISPER_MODELS_DIR, DIARIZATION_MODELS_DIR, OUTPUT_DIR, DEFAULT_PARAMETERS_CONFIG_PATH,
17
  UVR_MODELS_DIR)
18
+ from modules.utils.constants import AUTOMATIC_DETECTION
19
  from modules.utils.subtitle_manager import get_srt, get_vtt, get_txt, write_file, safe_filename
20
  from modules.utils.youtube_manager import get_ytdata, get_ytaudio
21
  from modules.utils.files_manager import get_media_files, format_gradio_files, load_yaml, save_yaml
 
127
  self.music_separator.offload()
128
 
129
  if vad_params.vad_filter:
 
 
 
 
130
  vad_options = VadOptions(
131
  threshold=vad_params.threshold,
132
  min_speech_duration_ms=vad_params.min_speech_duration_ms,
 
531
  params.whisper.hallucination_silence_threshold = None
532
  if params.whisper.language_detection_threshold == 0:
533
  params.whisper.language_detection_threshold = None
534
+ if params.vad.max_speech_duration_s >= 9999:
535
+ params.vad.max_speech_duration_s = float('inf')
536
  return params
537
 
538
  @staticmethod