MontrealCorpusTools / Montreal-Forced-Aligner

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

[BUG] sqlalchemy.exc.DataError: (psycopg2.errors.DivisionByZero) division by zero #736

Closed Jon-Zbw closed 4 months ago

Jon-Zbw commented 5 months ago

Debugging checklist

[ ] Have you updated to latest MFA version? version==2.2.4 [ ] Have you tried rerunning the command with the --clean flag? yes --single_speaker --clean -t "$temp_dir/$parent_dir_name/$dir_name"_temp -j 1

Describe the issue A clear and concise description of what the bug is. sqlalchemy.exc.DataError: (psycopg2.errors.DivisionByZero) division by zero (a lot of folders processed together, only some of them got this problem) For Reproducing your issue Please fill out the following: INFO Generating MFCCs...
100% ━━━━━━━━━━━━━━━━━━━━━━━━ 360,483/360,211 [ 0:50:13 < 0:00:00 , 121 it/s ] INFO Calculating CMVN...
INFO Generating final features...
100% ━━━━━━━━━━━━━━━━━━━━━╸ 360,111/360,211 [ 0:02:38 < 0:00:01 , 2,230 it/s ] WARNING There were 2 utterances ignored due to an issue in feature generation, see the log file for full details or run mfa validate on the corpus. INFO Creating corpus split with features...
99% ━━━━━━━━━━━━━━━━━━━━╸ 356,324/360,211 [ 0:00:07 < 0:00:01 , 77,520 it/s ] INFO Compiling training graphs...
100% ━━━━━━━━━━━━━━━━━━━━━━━━━╸ 360,209/360,211 [ 0:07:55 < -:--:-- , ? it/s ] INFO Performing first-pass alignment...
INFO Generating alignments...
65% ━━━━━━━━━━━━━━━━ 234,038/360,211 [ 2:10:22 < 1:12:20 , 29 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 0x7f90bc23d0f0>> Traceback (most recent call last): File "/env/lib/python3.10/site-packages/montreal_forced_aligner/command_line/mfa.py", line 97, in history_save_handler raise self.exception File "/env/bin/mfa", line 11, in sys.exit(mfa_cli()) File "/env/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/env/lib/python3.10/site-packages/rich_click/rich_command.py", line 126, in main rv = self.invoke(ctx) File "/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/env/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/env/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, *kwargs) File "/env/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func return f(get_current_context(), args, **kwargs) File "/env/lib/python3.10/site-packages/montreal_forced_aligner/command_line/align.py", line 113, in align_corpus_cli aligner.align() File "/env/lib/python3.10/site-packages/montreal_forced_aligner/alignment/pretrained.py", line 412, in align super().align() File "/env/lib/python3.10/site-packages/montreal_forced_aligner/alignment/base.py", line 345, in align self.align_utterances() File "/env/lib/python3.10/site-packages/montreal_forced_aligner/alignment/mixins.py", line 451, in align_utterances session.query(Utterance).filter( File "/env/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 3271, in update result: CursorResult[Any] = self.session.execute( File "/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2308, in execute return self._execute_internal( File "/env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2190, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/env/lib/python3.10/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1617, in orm_execute_statement return super().orm_execute_statement( File "/env/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1416, in execute return meth( File "/env/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 517, in _execute_on_connection return connection._execute_clauseelement( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement ret = self._execute_context( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context return self._exec_single_context( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context self._handle_dbapi_exception( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context self.dialect.do_execute( File "/env/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DataError: (psycopg2.errors.DivisionByZero) division by zero

[SQL: UPDATE utterance SET alignment_log_likelihood=(utterance.alignment_log_likelihood / CAST(utterance.num_frames AS NUMERIC)) WHERE utterance.alignment_log_likelihood IS NOT NULL RETURNING utterance.id] (Background on this error at: https://sqlalche.me/e/20/9h9h)

  1. Corpus structure
    • What language is the corpus in? mandarin
    • How many files/speakers? INFO Found 1 speaker across 360211 files, average number of utterances per speaker: 360211.0
    • Are you using lab files or TextGrid files for input? use txt file
  2. Dictionary
    • Are you using a dictionary from MFA? If so, which one? yes! Mandarin MFA dictionary v2.0.0a
    • If it's a custom dictionary, what is the phoneset? MFA
  3. Acoustic model
    • If you're using an acoustic model, is it one download through MFA? If so, which one? yes ! Mandarin MFA acoustic model v2.0.0a
    • If it's a model you've trained, what data was it trained on?

Log file Please attach the log file for the run that encountered an error (by default these will be stored in ~/Documents/MFA). File size too big: 25 MB are allowed, 86 MB were attempted to upload. Excerpt made for reference: align.log

Desktop (please complete the following information):

mmcauliffe commented 4 months ago

You can try upgrading to 3.0.0 or 2.2.17, 2.2.4 is pretty old, feel free to reopen if this is still an issue in 3.0.0.