Skip to content

Fix alignment fine-tune option and alignment archive path bug#930

Open
zuazo wants to merge 2 commits intoMontrealCorpusTools:mainfrom
zuazo-forks:finetune-fix
Open

Fix alignment fine-tune option and alignment archive path bug#930
zuazo wants to merge 2 commits intoMontrealCorpusTools:mainfrom
zuazo-forks:finetune-fix

Conversation

@zuazo
Copy link

@zuazo zuazo commented Nov 1, 2025

Hello!

This PR fixes two related issues affecting the --fine_tune functionality:

  • Fine-tuning not triggered: The PretrainedAligner.__init__() method was incorrectly assigning fine_tune_boundary_tolerance to self.fine_tune, effectively disabling fine-tuning even when the flag was passed. This is now fixed, and a regression test ensures the fine-tuning process is properly invoked.
    The issue has been present since Add remap alignments functionality #912 (v3.3.5).

  • Incorrect alignment archive path: The construction of .ark file paths during fine-tuning included an unintended leading dot in the extension (..ark), which caused a FileNotFoundError.
    Example traceback:

"~/.anaconda3/envs/aligner/lib/python3.11/site-packages/montreal_forced_aligner/alignment/multiprocessing.py", line 961, in _run
    alignment_archive = AlignmentArchive(ali_path)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.anaconda3/envs/aligner/lib/python3.11/site-packages/kalpy/gmm/data.py", line 296, in __init__
    raise OSError(f"Specified file does not exist: {file_name}")
OSError: Specified file does not exist: ~/Documents/MFA/test/alignment/ali.spanish_spain_mfa.2..ark 

This second issue remained hidden because the fine-tuning was never activated. But the test suite already fails if the ..ark bug resurfaces, so no extra assertion was added for that specific case.

To confirm that fine-tuning is now active, check that the aligner prints:

 INFO     Fine tuning alignments...

These changes are minimal and maintain backward compatibility with current usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant