MontrealCorpusTools / Montreal-Forced-Aligner

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

Disabling auto server to run MFA #599

Closed cdicanio closed 1 year ago

cdicanio commented 1 year ago

I did a fresh/new installation of miniconda and MFA on my new M1 macbook pro. I followed the website instructions, but the only caveat is that this is an institutional machine so I do not have admin privileges for general installation. So, miniconda and MFA are all installed locally. When I tried to align a speech sample (or validate one), an error is flagged and a number of lines of code seem unable to run. When I looked at the log file, I saw there was an error "terminating connection due to administrator command." Yet, this seems to be unrelated to this being installed locally. When I inquired about this with Jeff Mielke, he figured out that it had to do with PostGreSQL. So, a work-around solution is:

  1. mfa configure --disable_auto_server
  2. Delete the ~/Documents/MFA directory
  3. mfa server init
  4. mfa server start
  5. mfa align ...

And this works fine.

I assisted a student in installing and running MFA the other day though, using the same exact steps and the same data. It worked fine. So, perhaps this is an issue with PostGreSQL and macs? or M1 macs? Or miniConda on a mac running PostGreSQL?

The specific lines of code that did not work, with the error messages: (aligner) cast-cdicanioml:foo2 cdicanio$ mfa validate /Users/cdicanio/Research_programs/montreal-forced-aligner/foo2 english_us_arpa english_us_arpa waiting for server to start.... done server started INFO Setting up corpus information...
INFO Found 1 speaker across 2 files, average number of utterances per speaker: 5.0
INFO Initializing multiprocessing jobs...
WARNING Number of jobs was specified as 3, but due to only having 1 speakers, MFA will only use 1 jobs. Use the --single_speaker flag if you would like to split utterances across jobs regardless of their speaker.
INFO Text already normalized.
ERROR There was an error in the run, please see the log.
INFO Stopping the global MFA database server...
Exception ignored in atexit callback: <bound method ExitHooks.history_save_handler of <montreal_forced_aligner.command_line.mfa.ExitHooks object at 0x101102c50>> Traceback (most recent call last): File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/mfa.py", line 102, in history_save_handler raise self.exception File "/Users/cdicanio/miniconda3/envs/aligner/bin/mfa", line 10, in sys.exit(mfa_cli()) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1130, in call return self.main(*args, kwargs) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/rich_click/rich_group.py", line 21, in main rv = super().main(args, standalone_mode=False, kwargs) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(args, kwargs) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/validate.py", line 113, in validate_corpus_cli validator.validate() File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/validation/corpus_validator.py", line 595, in validate self.setup() File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/validation/corpus_validator.py", line 560, in setup self.write_lexicon_information() File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/dictionary/multispeaker.py", line 1792, in write_lexicon_information self._write_fst_binary( File "/Users/cdicanio/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/dictionary/multispeaker.py", line 1424, in _write_fst_binary f.write(str(self.word_mapping(dictionary.id)["#0"])) KeyError: '#0'

mmcauliffe commented 1 year ago

Can you try running the same command with --clean, it looks like the validator isn't resetting correctly for validation, so I'll fix that, but using the clean flag should do the trick in the meantime.

cdicanio commented 1 year ago

Which same command? The validate command or the mfa configure? I was getting similar errors running mfa align.

mmcauliffe commented 1 year ago

Ah, right, so if you run mfa align ... --clean or mfa validate ... --clean that should cause any previously loaded data for the corpus to be discarded and start from scratch. Running mfa configure --always_clean will make --clean be included in any subsequent mfa commands.