MontrealCorpusTools / Montreal-Forced-Aligner

Command line utility for forced alignment using Kaldi
https://montrealcorpustools.github.io/Montreal-Forced-Aligner/
MIT License
1.35k stars 250 forks source link

[BUG] AttributeError: 'MfccComputer' object has no attribute 'parameters' when aligning dataset. #787

Open dan-ya opened 7 months ago

dan-ya commented 7 months ago

Debugging checklist

[x] Have you read the troubleshooting page (https://montreal-forced-aligner.readthedocs.io/en/latest/user_guide/troubleshooting.html) and searched the documentation to ensure that your issue is not addressed there? [x] Have you updated to latest MFA version (check https://montreal-forced-aligner.readthedocs.io/en/latest/changelog/changelog_3.0.html)? What is the output of mfa version? [x] Have you tried rerunning the command with the --clean flag?

Describe the issue I want to align some data from Providence Corpus (with .lab files as input). The same error happens both with--clean flag and without. I have tried to validate the corpus with a following command and got the same error: mfa validate archive/Providence_mfa_dataset english_us_arpa english_us_arpa --clean

Both the model and the dictionary are pre-trained and were just downloaded with:

mfa model download acoustic english_us_arpa
mfa model download dictionary english_us_arpa

The output is the following:

 INFO     Setting up corpus information...                                    
 INFO     Loading corpus from source files...                                 
 100% ━━━━━━━━━━━━━━━━━━━━━━━━ 123,135/100  [ 0:00:00 < 0:00:00 , 3,444 it/s ]
 INFO     Found 6 speakers across 123452 files, average number of utterances  
          per speaker: 20575.333333333332                                     
 INFO     Initializing multiprocessing jobs...                                
 INFO     Normalizing text...                                                 
 100% ━━━━━━━━━━━━━━━━━━━━ 123,452/123,452  [ 0:00:39 < 0:00:00 , 4,303 it/s ]
 INFO     Generating MFCCs...                                                 
   0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/123,452  [ 0:00:05 < -:--:-- , ? it/s ] ERROR    There was an error in the run, please see the log.                  
Exception ignored in atexit callback: <bound method 
ExitHooks.history_save_handler of 
<montreal_forced_aligner.command_line.mfa.ExitHooks object at 0x10fbc6d50>>
Traceback (most recent call last):
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/command_line/mfa.py", line 107, in history_save_handler
    raise self.exception
  File "/opt/anaconda3/envs/montreal/bin/mfa", line 10, in <module>
    sys.exit(mfa_cli())
             ^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/click/core.py", 
line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/rich_click/rich_com
mand.py", line 126, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/click/core.py", 
line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/click/core.py", 
line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/click/core.py", 
line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/click/decorators.py
", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/command_line/validate.py", line 137, in validate_corpus_cli
    validator.validate()
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/validation/corpus_validator.py", line 505, in validate
    self.setup()
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/validation/corpus_validator.py", line 485, in setup
    self.generate_features()
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/corpus/acoustic_corpus.py", line 528, in generate_features
    self.mfcc()
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/corpus/acoustic_corpus.py", line 662, in mfcc
    for _ in run_kaldi_function(MfccFunction, arguments, 
total_count=self.num_utterances):
  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/utils.py", line 735, in run_kaldi_function
    raise v
montreal_forced_aligner.exceptions.MultiprocessingError: MultiprocessingError:

Job 1 encountered an error:
Traceback (most recent call last):

  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/abc.py", line 102, in run
    self._run()

  File 
"/opt/anaconda3/envs/montreal/lib/python3.11/site-packages/montreal_forced_ali
gner/corpus/features.py", line 198, in _run
    mfcc_logger.debug(f"MFCC parameters: {self.mfcc_computer.parameters}")
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'MfccComputer' object has no attribute 'parameters'
   0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/123,452  [ 0:00:05 < -:--:-- , ? it/s ]

Desktop (please complete the following information):

mmcauliffe commented 7 months ago

Can you try running conda update -c conda-forge kalpy and retry?

dan-ya commented 7 months ago

Thank you! Now it is fine. There is another strange issue. It got stuck at the Exporting alignment TextGrids to ... stage:

INFO     Setting up corpus information...                  
 INFO     Found 6 speakers across 123452 files, average     
          number of utterances per speaker:                 
          20575.333333333332                                
 INFO     Jobs already initialized.                         
 INFO     Text already normalized.                          
 INFO     Generating MFCCs...                               
 100% ━━━━━━━━━━ 123,452/1… [ 0:03:41 < 0:00:00 , 384 it/s ]
 INFO     Calculating CMVN...                               
 INFO     Generating final features...                      
 100% ━━━━━━━━━ 123,452/… [ 0:00:09 < 0:00:00 , 14,900     ]
                                                it/s        
 INFO     Creating corpus split...                          
 100% ━━━━━━━━━ 123,452/… [ 0:00:04 < 0:00:00 , 40,003     ]
                                                it/s        
 INFO     Compiling training graphs...                      
 INFO     Performing first-pass alignment...                
 INFO     Generating alignments...                          
 100% ━━━━━━━━━━ 123,452/1… [ 0:05:15 < 0:00:00 , 250 it/s ]
 INFO     Calculating fMLLR for speaker adaptation...       
  99% ━━━━━━━━╸ 121,921/1… [ 0:01:12 < 0:00:02 , 1,451     ]
                                                 it/s       
 INFO     Performing second-pass alignment...               
 INFO     Generating alignments...                          
 100% ━━━━━━━━━━ 123,452/1… [ 0:04:19 < 0:00:00 , 300 it/s ]
 INFO     Collecting phone and word alignments from         
          alignment lattices...                             
  99% ━━━━━━━━╸ 122,119/1… [ 0:00:21 < 0:00:01 , 6,662     ]
                                                 it/s       
 WARNING  Alignment analysis not available without using    
          postgresql                                        
 INFO     Exporting alignment TextGrids to                  
          Providence_mfa_aligned.arpa...                    
   0% ━━━━━━━━━━━━ 0/123,452  [ 1:04:02 < -:--:-- , ? it/s ]