montreal_forced_aligner/transcription/transcriber.py
def create_hclgs(self):
        """
        Create HCLG.fst files for every dictionary being used by a :class:`~montreal_forced_aligner.transcription.transcriber.Transcriber`
        """

        dict_arguments = self.create_hclgs_arguments()
        dict_arguments = list(dict_arguments.values())
        self.logger.info("Generating HCLG.fst...")
        if self.use_mp:
            manager = mp.Manager()
            error_dict = manager.dict()
            return_queue = manager.Queue()
            stopped = Stopped()
            procs = []
            for i, args in enumerate(dict_arguments):
                function = CreateHclgFunction(args)
                p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                procs.append(p)
                p.start()
            with tqdm.tqdm(total=len(dict_arguments)) as pbar:
                while True:
                    try:
                        result, hclg_path = 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 result:
                        self.log_debug(f"Done generating {hclg_path}!")
                    else:
                        self.log_warning(f"There was an error in generating {hclg_path}")
                    pbar.update(1)
            for p in procs:
                p.join()
            if error_dict:
                for v in error_dict.values():
                    raise v
        else:
            for args in dict_arguments:
                function = CreateHclgFunction(args)
                with tqdm.tqdm(total=len(dict_arguments)) as pbar:
                    for result, hclg_path in function.run():
                        if result:
                            self.log_debug(f"Done generating {hclg_path}!")
                        else:
                            self.log_warning(f"There was an error in generating {hclg_path}")
                        pbar.update(1)
        error_logs = []
        for arg in dict_arguments:
            if not os.path.exists(arg.hclg_path):
                error_logs.append(arg.log_path)
        if error_logs:
            raise KaldiProcessingError(error_logs)

        Create HCLG.fst files for every dictionary being used by a :class:`~montreal_forced_aligner.transcription.transcriber.Transcriber`
        
Create HCLG.fst files for every dictionary being used by a :class:`~montreal_forced_aligner.transcription.transcriber.Transcriber`
Create HCLG . fst files for every dictionary being used by a : class : ` ~montreal_forced_aligner . transcription . transcriber . Transcriber `
def create_hclgs(self):
        dict_arguments = self.create_hclgs_arguments()
        dict_arguments = list(dict_arguments.values())
        self.logger.info("Generating HCLG.fst...")
        if self.use_mp:
            manager = mp.Manager()
            error_dict = manager.dict()
            return_queue = manager.Queue()
            stopped = Stopped()
            procs = []
            for i, args in enumerate(dict_arguments):
                function = CreateHclgFunction(args)
                p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                procs.append(p)
                p.start()
            with tqdm.tqdm(total=len(dict_arguments)) as pbar:
                while True:
                    try:
                        result, hclg_path = 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 result:
                        self.log_debug(f"Done generating {hclg_path}!")
                    else:
                        self.log_warning(f"There was an error in generating {hclg_path}")
                    pbar.update(1)
            for p in procs:
                p.join()
            if error_dict:
                for v in error_dict.values():
                    raise v
        else:
            for args in dict_arguments:
                function = CreateHclgFunction(args)
                with tqdm.tqdm(total=len(dict_arguments)) as pbar:
                    for result, hclg_path in function.run():
                        if result:
                            self.log_debug(f"Done generating {hclg_path}!")
                        else:
                            self.log_warning(f"There was an error in generating {hclg_path}")
                        pbar.update(1)
        error_logs = []
        for arg in dict_arguments:
            if not os.path.exists(arg.hclg_path):
                error_logs.append(arg.log_path)
        if error_logs:
            raise KaldiProcessingError(error_logs)
def create_hclgs ( self ) : dict_arguments = self . create_hclgs_arguments ( ) dict_arguments = list ( dict_arguments . values ( ) ) self . logger . info ( "Generating HCLG.fst..." ) if self . use_mp : manager = mp . Manager ( ) error_dict = manager . dict ( ) return_queue = manager . Queue ( ) stopped = Stopped ( ) procs = [ ] for i , args in enumerate ( dict_arguments ) : function = CreateHclgFunction ( args ) p = KaldiProcessWorker ( i , return_queue , function , error_dict , stopped ) procs . append ( p ) p . start ( ) with tqdm . tqdm ( total = len ( dict_arguments ) ) as pbar : while True : try : result , hclg_path = 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 result : self . log_debug ( f"Done generating {hclg_path}!" ) else : self . log_warning ( f"There was an error in generating {hclg_path}" ) pbar . update ( 1 ) for p in procs : p . join ( ) if error_dict : for v in error_dict . values ( ) : raise v else : for args in dict_arguments : function = CreateHclgFunction ( args ) with tqdm . tqdm ( total = len ( dict_arguments ) ) as pbar : for result , hclg_path in function . run ( ) : if result : self . log_debug ( f"Done generating {hclg_path}!" ) else : self . log_warning ( f"There was an error in generating {hclg_path}" ) pbar . update ( 1 ) error_logs = [ ] for arg in dict_arguments : if not os . path . exists ( arg . hclg_path ) : error_logs . append ( arg . log_path ) if error_logs : raise KaldiProcessingError ( error_logs )
Create HCLG.fst files for every dictionary being used by a :class:`~montreal_forced_aligner.transcription.transcriber.Transcriber`
Create HCLG . fst files for every dictionary being used by a : class : ` ~montreal_forced_aligner . transcription . transcriber . Transcriber `
"""
        Create HCLG.fst files for every dictionary being used by a :class:`~montreal_forced_aligner.transcription.transcriber.Transcriber`
        """
self