Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Usage question #204

Closed
qo4on opened this issue Jan 10, 2021 · 13 comments
Closed

Usage question #204

qo4on opened this issue Jan 10, 2021 · 13 comments

Comments

@qo4on
Copy link

qo4on commented Jan 10, 2021

The documentation has a line:

bin/mfa_align corpus_directory dictionary_path acoustic_model_path output_directory

Where if I understand correctly:
acoustic_model_path - montreal-forced-aligner\pretrained_models\english.zip
output_directory - any empty directory for aligned text files

What is corpus_directory and dictionary_path?
I have English voice 0.wav file and its transcript 0.txt. How should I feed them to mfa_align to get a timestamp for each word of 0.txt?

@mmcauliffe
Copy link
Member

So if you have those 0.wav and 0.txt in a directory, the corpus_directory is the path to that containing directory. dictionary_path should point to a dictionary text file (that specifies how words are pronounced). There's a dictionary here for english that works with the pretrained model: https://github.com/MontrealCorpusTools/mfa-models/blob/master/dictionary/english.dict.

@qo4on
Copy link
Author

qo4on commented Jan 13, 2021

Thank you for your help. I tried this in Colab, but got an error:

!sudo apt-get update -y -qqq --fix-missing && apt-get install -y -qqq ffmpeg > /dev/null

!wget https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/releases/download/v1.0.1/montreal-forced-aligner_linux.tar.gz -qqq
!wget https://github.com/MontrealCorpusTools/mfa-models/raw/master/dictionary/english.dict -qqq
!tar -xf montreal-forced-aligner_linux.tar.gz
!mkdir corpus_directory output_directory

mfa_align = "/content/montreal-forced-aligner/bin/mfa_align"
corpus_directory = "/content/corpus_directory"
dictionary_path = "/content/english.dict"
acoustic_model_path = "/content/montreal-forced-aligner/pretrained_models/english.zip"
output_directory = "/content/output_directory"

!ffmpeg -y -i /content/23.mp3 -acodec pcm_s16le $corpus_directory/0.wav
!printf "Some text" > $corpus_directory/0.txt

!$mfa_align $corpus_directory $dictionary_path $acoustic_model_path $output_directory
[1046] Error loading Python lib '/content/montreal-forced-aligner/lib/libpython3.6m.so': dlopen: /content/montreal-forced-aligner/lib/libpython3.6m.so: cannot open shared object file: No such file or directory

Colab has Python 3.6.9.

I renamed
/content/montreal-forced-aligner/lib/libpython3.6m.so.1.0
to
/content/montreal-forced-aligner/lib/libpython3.6m.so
and got another error:

Setting up corpus information...
Number of speakers in corpus: 1, average number of utterances per speaker: 1.0
/content/montreal-forced-aligner/lib/aligner/models.py:87: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
Creating dictionary information...
Setting up training data...
There were words not found in the dictionary. Would you like to abort to fix them? (Y/N)

@mmcauliffe
Copy link
Member

That's not an error per se, you can simply say "N" to continue with the alignment (and have the OOV words modeled as ""). You can also supply the -q flag to the aligner to make it not check for OOVs

@qo4on
Copy link
Author

qo4on commented Jan 15, 2021

I don't know why but it does not work either:

!$mfa_align -q $corpus_directory $dictionary_path $acoustic_model_path $output_directory

Setting up corpus information...
Number of speakers in corpus: 1, average number of utterances per speaker: 1.0
/content/montreal-forced-aligner/lib/aligner/models.py:87: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
Creating dictionary information...
Setting up training data...
Calculating MFCCs...
Traceback (most recent call last):
  File "aligner/command_line/align.py", line 186, in <module>
  File "aligner/command_line/align.py", line 142, in validate_args
  File "aligner/command_line/align.py", line 94, in align_corpus
  File "aligner/aligner/pretrained.py", line 74, in __init__
  File "aligner/aligner/pretrained.py", line 122, in setup
  File "aligner/aligner/base.py", line 89, in setup
  File "aligner/corpus.py", line 979, in initialize_corpus
  File "aligner/corpus.py", line 852, in create_mfccs
  File "aligner/corpus.py", line 863, in _combine_feats
FileNotFoundError: [Errno 2] No such file or directory: '/root/Documents/MFA/corpus_directory/train/mfcc/raw_mfcc.0.scp'
[848] Failed to execute script align

@nrgslp
Copy link

nrgslp commented Jan 15, 2021

I was able to resolve this by installing openblas. Here is some context; the comment I linked has a link to the work around: #91 (comment)

@qo4on
Copy link
Author

qo4on commented Jan 16, 2021

I'm not sure how to install OpenBLAS in Colab. Is there any working example of Montreal-Forced-Aligner usage? I mean a simple starting example to see what it's doing. At the moment, it's completely unusable, everything I have tried returns errors.
If it works for you, please copy paste your code here.

@mmcauliffe
Copy link
Member

mmcauliffe commented Jan 16, 2021 via email

@qo4on
Copy link
Author

qo4on commented Jan 20, 2021

sudo apt-get install libopenblas0

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libopenblas0

@mmcauliffe
Copy link
Member

mmcauliffe commented Jan 20, 2021 via email

@qo4on
Copy link
Author

qo4on commented Jan 20, 2021

Is there anybody who managed to run Montreal-Forced-Aligner without errors?

@nrgslp
Copy link

nrgslp commented Jan 20, 2021

Is there anybody who managed to run Montreal-Forced-Aligner without errors?

Yes, in both Windows and Debian.

@qo4on
Copy link
Author

qo4on commented Jan 20, 2021

Yes, in both Windows and Debian.

Can you show your code for both?

@nrgslp
Copy link

nrgslp commented Jan 21, 2021

For alignment follow this template:

  • Windows v 1.0:
    bin/mfa_align corpus_directory dictionary_path acoustic_model_path output_directory

  • Debian v2.0:
    mfa align corpus_directory dictionary_path acoustic_model_path output_directory

So, for me I ran:

  • Windows v1.0:
    mfa_align c:\...\job-1\ c:\...CMU.dict english c:\...\output\job-1b\ -j 8 -i

  • Debian v2.0:
    mfa align /.../job-2/ /.../CMU.dict english /.../output/job-2/ -j 8 i

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants