montreal_forced_aligner/transcription/transcriber.py
def carpa_lm_rescore(self):
        """
        Rescore lattices with CARPA language model

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.CarpaLmRescoreFunction`
            Multiprocessing function
        :meth:`.Transcriber.carpa_lm_rescore_arguments`
            Arguments for function
        """
        self.logger.info("Rescoring lattices with large G.carpa...")
        if self.use_mp:
            manager = mp.Manager()
            error_dict = manager.dict()
            return_queue = manager.Queue()
            stopped = Stopped()
            procs = []
            for i, args in enumerate(self.carpa_lm_rescore_arguments()):
                function = CarpaLmRescoreFunction(args)
                p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                procs.append(p)
                p.start()
            with tqdm.tqdm(total=self.num_utterances) as pbar:
                while True:
                    try:
                        succeeded, failed = return_queue.get(timeout=1)
                        # print(utterance)
                        if stopped.stop_check():
                            continue
                    except Empty:
                        for proc in procs:
                            if not proc.finished.stop_check():
                                break
                        else:
                            break
                        continue
                    if failed:
                        self.log_warning("Some lattices failed to be rescored")
                    pbar.update(succeeded + failed)
            for p in procs:
                p.join()
            if error_dict:
                for v in error_dict.values():
                    raise v
        else:
            for args in self.carpa_lm_rescore_arguments():
                function = CarpaLmRescoreFunction(args)
                with tqdm.tqdm(total=self.num_utterances) as pbar:
                    for succeeded, failed in function.run():
                        if failed:
                            self.log_warning("Some lattices failed to be rescored")
                        pbar.update(succeeded + failed)

        Rescore lattices with CARPA language model

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.CarpaLmRescoreFunction`
            Multiprocessing function
        :meth:`.Transcriber.carpa_lm_rescore_arguments`
            Arguments for function
        
Rescore lattices with CARPA language model
See Also
Rescore lattices with CARPA language model See Also
def carpa_lm_rescore(self):
        self.logger.info("Rescoring lattices with large G.carpa...")
        if self.use_mp:
            manager = mp.Manager()
            error_dict = manager.dict()
            return_queue = manager.Queue()
            stopped = Stopped()
            procs = []
            for i, args in enumerate(self.carpa_lm_rescore_arguments()):
                function = CarpaLmRescoreFunction(args)
                p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                procs.append(p)
                p.start()
            with tqdm.tqdm(total=self.num_utterances) as pbar:
                while True:
                    try:
                        succeeded, failed = 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
                    if failed:
                        self.log_warning("Some lattices failed to be rescored")
                    pbar.update(succeeded + failed)
            for p in procs:
                p.join()
            if error_dict:
                for v in error_dict.values():
                    raise v
        else:
            for args in self.carpa_lm_rescore_arguments():
                function = CarpaLmRescoreFunction(args)
                with tqdm.tqdm(total=self.num_utterances) as pbar:
                    for succeeded, failed in function.run():
                        if failed:
                            self.log_warning("Some lattices failed to be rescored")
                        pbar.update(succeeded + failed)
def carpa_lm_rescore ( self ) : self . logger . info ( "Rescoring lattices with large G.carpa..." ) if self . use_mp : manager = mp . Manager ( ) error_dict = manager . dict ( ) return_queue = manager . Queue ( ) stopped = Stopped ( ) procs = [ ] for i , args in enumerate ( self . carpa_lm_rescore_arguments ( ) ) : function = CarpaLmRescoreFunction ( args ) p = KaldiProcessWorker ( i , return_queue , function , error_dict , stopped ) procs . append ( p ) p . start ( ) with tqdm . tqdm ( total = self . num_utterances ) as pbar : while True : try : succeeded , failed = 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 if failed : self . log_warning ( "Some lattices failed to be rescored" ) pbar . update ( succeeded + failed ) for p in procs : p . join ( ) if error_dict : for v in error_dict . values ( ) : raise v else : for args in self . carpa_lm_rescore_arguments ( ) : function = CarpaLmRescoreFunction ( args ) with tqdm . tqdm ( total = self . num_utterances ) as pbar : for succeeded , failed in function . run ( ) : if failed : self . log_warning ( "Some lattices failed to be rescored" ) pbar . update ( succeeded + failed )
Rescore lattices with CARPA language model
See Also
Rescore lattices with CARPA language model See Also
"""
        Rescore lattices with CARPA language model

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.CarpaLmRescoreFunction`
            Multiprocessing function
        :meth:`.Transcriber.carpa_lm_rescore_arguments`
            Arguments for function
        """ # print(utterance)
self
class
`~montreal_forced_aligner.transcription.multiprocessing.CarpaLmRescoreFunction`
Multiprocessing function
` ~montreal_forced_aligner . transcription . multiprocessing . CarpaLmRescoreFunction ` Multiprocessing function
meth
`.Transcriber.carpa_lm_rescore_arguments`
Arguments for function
` . Transcriber . carpa_lm_rescore_arguments ` Arguments for function