diff --git a/open_dubbing/dubbing.py b/open_dubbing/dubbing.py index 06caf49..e83509c 100644 --- a/open_dubbing/dubbing.py +++ b/open_dubbing/dubbing.py @@ -167,7 +167,7 @@ def pyannote_pipeline(self) -> Pipeline: def _verify_api_access(self) -> None: """Verifies access to all the required APIs.""" - logging.info("Verifying access to PyAnnote from HuggingFace.") + logging.debug("Verifying access to PyAnnote from HuggingFace.") if not self.pyannote_pipeline: raise PyAnnoteAccessError( "No access to HuggingFace. Make sure you passed the correct API token" @@ -178,7 +178,7 @@ def _verify_api_access(self) -> None: " diarization model" " (https://huggingface.co/pyannote/speaker-diarization-3.1)." ) - logging.info("Access to PyAnnote from HuggingFace verified.") + logging.debug("Access to PyAnnote from HuggingFace verified.") def run_preprocessing(self) -> None: """Splits audio/video, applies DEMUCS, and segments audio into utterances with PyAnnote. @@ -361,7 +361,7 @@ def run_save_utterance_metadata(self) -> None: os.fsync(temporary_file.fileno()) shutil.copy(temporary_file.name, utterance_metadata_file) os.remove(temporary_file.name) - logging.info( + logging.debug( "Utterance metadata saved successfully to" f" '{utterance_metadata_file}'" ) @@ -374,7 +374,10 @@ def dub(self) -> PostprocessingArtifacts: self._verify_api_access() logging.info("Dubbing process starting...") start_time = time.time() + + task_start_time = time.time() self.run_preprocessing() + self.log_debug_task("Preprocessing completed", task_start_time) logging.info("Speech to text...") task_start_time = time.time() diff --git a/open_dubbing/speech_to_text.py b/open_dubbing/speech_to_text.py index cfc02a7..45de5ee 100644 --- a/open_dubbing/speech_to_text.py +++ b/open_dubbing/speech_to_text.py @@ -113,7 +113,7 @@ def diarize_speakers( _tuple = ("speaker_01", "Male") r.append(_tuple) - logging.info(f"text_to_speech.diarize_speakers. Returns: {r}") + logging.debug(f"text_to_speech.diarize_speakers. Returns: {r}") return r def add_speaker_info( diff --git a/open_dubbing/text_to_speech.py b/open_dubbing/text_to_speech.py index 4dc8b5f..b185888 100644 --- a/open_dubbing/text_to_speech.py +++ b/open_dubbing/text_to_speech.py @@ -44,7 +44,7 @@ def assign_voices( ) -> Mapping[str, str | None]: voice_assignment = {"speaker_01": "ona"} - logging.info(f"TextToSpeech.assign_voices. Returns: {voice_assignment}") + logging.debug(f"TextToSpeech.assign_voices. Returns: {voice_assignment}") return voice_assignment def _convert_to_mp3(self, input_file, output_mp3): @@ -164,12 +164,12 @@ def _adjust_audio_speed( crossfade = max(1, chunk_size // 2) MAX_SPEED = 1.3 if speed > MAX_SPEED: - logging.info( + logging.debug( f"TextToSpeech.adjust_audio_speed: Reduced speed from {speed} to {MAX_SPEED}" ) speed = MAX_SPEED - logging.info( + logging.debug( f"TextToSpeech.adjust_audio_speed: dubbed_audio: {dubbed_file}, speed: {speed}, chunk_size: {chunk_size}, crossfade: {crossfade}" ) output_audio = speedup( diff --git a/open_dubbing/translation.py b/open_dubbing/translation.py index ce69753..2d009fd 100644 --- a/open_dubbing/translation.py +++ b/open_dubbing/translation.py @@ -34,7 +34,7 @@ def generate_script(self, *, utterance_metadata, key: str = "text") -> str: trimmed_lines = [ item[key].strip() if item[key] else "" for item in utterance_metadata ] - logging.info(f"translation.generate_script. Input: {trimmed_lines}") + logging.debug(f"translation.generate_script. Input: {trimmed_lines}") r = _BREAK_MARKER + _BREAK_MARKER.join(trimmed_lines) + _BREAK_MARKER logging.debug(f"translation.generate_script. Returns: {r}") return r diff --git a/r.sh b/r.sh index 2a000c9..4caaf02 100755 --- a/r.sh +++ b/r.sh @@ -21,6 +21,7 @@ for tts in "${tts_list[@]}"; do --target_language="$language" \ --tts="$tts" \ --device=cpu + echo "" done done done