montreal_forced_aligner/corpus/acoustic_corpus.py
def compute_vad(self) -> None:
        """
        Compute Voice Activity Detection features over the corpus

        See Also
        --------
        :class:`~montreal_forced_aligner.corpus.features.ComputeVadFunction`
            Multiprocessing helper function for each job
        :meth:`.AcousticCorpusMixin.compute_vad_arguments`
            Job method for generating arguments for helper function
        """
        if os.path.exists(os.path.join(self.split_directory, "vad.0.scp")):
            self.log_info("VAD already computed, skipping!")
            return
        begin = time.time()
        self.log_info("Computing VAD...")

        arguments = self.compute_vad_arguments()
        with tqdm.tqdm(total=self.num_speakers) as pbar:
            if self.use_mp:
                manager = mp.Manager()
                error_dict = manager.dict()
                return_queue = manager.Queue()
                stopped = Stopped()
                procs = []
                for i, args in enumerate(arguments):
                    function = ComputeVadFunction(args)
                    p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                    procs.append(p)
                    p.start()
                while True:
                    try:
                        done, no_feats, unvoiced = return_queue.get(timeout=1)
                        if stopped.stop_check():
                            continue
                    except Empty:
                        for proc in procs:
                            if not proc.finished.stop_check():
                                break
                        else:
                            break
                        continue
                    pbar.update(done + no_feats + unvoiced)
                for p in procs:
                    p.join()
                if error_dict:
                    for v in error_dict.values():
                        raise v
            else:
                for args in arguments:
                    function = ComputeVadFunction(args)
                    for done, no_feats, unvoiced in function.run():
                        pbar.update(done + no_feats + unvoiced)
        self.log_debug(f"VAD computation took {time.time() - begin}")

        Compute Voice Activity Detection features over the corpus

        See Also
        --------
        :class:`~montreal_forced_aligner.corpus.features.ComputeVadFunction`
            Multiprocessing helper function for each job
        :meth:`.AcousticCorpusMixin.compute_vad_arguments`
            Job method for generating arguments for helper function
        
Compute Voice Activity Detection features over the corpus
See Also
Compute Voice Activity Detection features over the corpus See Also
def compute_vad(self) -> None:
        if os.path.exists(os.path.join(self.split_directory, "vad.0.scp")):
            self.log_info("VAD already computed, skipping!")
            return
        begin = time.time()
        self.log_info("Computing VAD...")
        arguments = self.compute_vad_arguments()
        with tqdm.tqdm(total=self.num_speakers) as pbar:
            if self.use_mp:
                manager = mp.Manager()
                error_dict = manager.dict()
                return_queue = manager.Queue()
                stopped = Stopped()
                procs = []
                for i, args in enumerate(arguments):
                    function = ComputeVadFunction(args)
                    p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                    procs.append(p)
                    p.start()
                while True:
                    try:
                        done, no_feats, unvoiced = return_queue.get(timeout=1)
                        if stopped.stop_check():
                            continue
                    except Empty:
                        for proc in procs:
                            if not proc.finished.stop_check():
                                break
                        else:
                            break
                        continue
                    pbar.update(done + no_feats + unvoiced)
                for p in procs:
                    p.join()
                if error_dict:
                    for v in error_dict.values():
                        raise v
            else:
                for args in arguments:
                    function = ComputeVadFunction(args)
                    for done, no_feats, unvoiced in function.run():
                        pbar.update(done + no_feats + unvoiced)
        self.log_debug(f"VAD computation took {time.time() - begin}")
def compute_vad ( self ) -> None : if os . path . exists ( os . path . join ( self . split_directory , "vad.0.scp" ) ) : self . log_info ( "VAD already computed, skipping!" ) return begin = time . time ( ) self . log_info ( "Computing VAD..." ) arguments = self . compute_vad_arguments ( ) with tqdm . tqdm ( total = self . num_speakers ) as pbar : if self . use_mp : manager = mp . Manager ( ) error_dict = manager . dict ( ) return_queue = manager . Queue ( ) stopped = Stopped ( ) procs = [ ] for i , args in enumerate ( arguments ) : function = ComputeVadFunction ( args ) p = KaldiProcessWorker ( i , return_queue , function , error_dict , stopped ) procs . append ( p ) p . start ( ) while True : try : done , no_feats , unvoiced = return_queue . get ( timeout = 1 ) if stopped . stop_check ( ) : continue except Empty : for proc in procs : if not proc . finished . stop_check ( ) : break else : break continue pbar . update ( done + no_feats + unvoiced ) for p in procs : p . join ( ) if error_dict : for v in error_dict . values ( ) : raise v else : for args in arguments : function = ComputeVadFunction ( args ) for done , no_feats , unvoiced in function . run ( ) : pbar . update ( done + no_feats + unvoiced ) self . log_debug ( f"VAD computation took {time.time() - begin}" )
Compute Voice Activity Detection features over the corpus
See Also
Compute Voice Activity Detection features over the corpus See Also
"""
        Compute Voice Activity Detection features over the corpus

        See Also
        --------
        :class:`~montreal_forced_aligner.corpus.features.ComputeVadFunction`
            Multiprocessing helper function for each job
        :meth:`.AcousticCorpusMixin.compute_vad_arguments`
            Job method for generating arguments for helper function
        """
self
class
`~montreal_forced_aligner.corpus.features.ComputeVadFunction`
Multiprocessing helper function for each job
` ~montreal_forced_aligner . corpus . features . ComputeVadFunction ` Multiprocessing helper function for each job
meth
`.AcousticCorpusMixin.compute_vad_arguments`
Job method for generating arguments for helper function
` . AcousticCorpusMixin . compute_vad_arguments ` Job method for generating arguments for helper function