-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding MFA scripts #4557
Adding MFA scripts #4557
Conversation
…The recipe `mfa.sh` details the entire conversion process, and `tts.sh` and `data.sh` (for LJSpeech only) have been edited to produce required text and durations files.
…The recipe `mfa.sh` details the entire conversion process, and `tts.sh` and `data.sh` (for LJSpeech only) have been edited to produce required text and durations files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reviewing and thank you for adding cool features!
Could you reflect my comments and fix the CI errors?
egs2/TEMPLATE/tts1/tts.sh
Outdated
local/data.sh ${local_data_opts} | ||
local_data_opts+="--token_type ${token_type} --g2p ${g2p}" | ||
local/data.sh "${local_data_opts}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not touch here, which may affect all of the recipes.
You can add local_data_opts
in run.sh
.
And ${local_data_opts}
is different "${local_data_opts}" (latter is not parsed.)
egs2/ljspeech/tts1/local/data.sh
Outdated
log "$0 $*" | ||
token_type='' | ||
g2p='' | ||
. utils/parse_options.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding use_mfa
?
log "$0 $*" | |
token_type='' | |
g2p='' | |
. utils/parse_options.sh | |
use_mfa=false | |
token_type=phn | |
g2p=g2p_en_no_space | |
log "$0 $*" | |
. utils/parse_options.sh | |
if "${use_mfa}"; then | |
if [ ${token_type} != "phn" ]; then | |
echo "ERROR: token_type must be phn when use_mfa=true." | |
exit 1 | |
fi | |
if [ ${g2p} != "none" ]; then | |
echo "ERROR: g2p must be none when use_mfa=true." | |
exit 1 | |
fi | |
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And could you add mfa installation check in the if expression?
egs2/ljspeech/tts1/local/data.sh
Outdated
<(cut -d "|" -f 1 < ${db_root}/LJSpeech-1.1/metadata.csv) \ | ||
<(cut -d "|" -f 3 < ${db_root}/LJSpeech-1.1/metadata.csv) \ | ||
> ${text} | ||
if [ "${token_type}" = 'phn' ] && [ -z "${g2p}" ]; then # text should be phonemes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ "${token_type}" = 'phn' ] && [ -z "${g2p}" ]; then # text should be phonemes! | |
if "${use_mfa}"; then # text should be phonemes! |
--n_shift "${n_shift}" \ | ||
--token_type phn \ | ||
--cleaner none \ | ||
--g2p none \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--g2p none \ | |
--g2p none \ | |
--local_data_opts "--token_type phn --g2p none --use_mfa true" \ |
egs2/ljspeech/tts1/run_mfa.sh
Outdated
#!/usr/bin/env bash | ||
# Set bash to 'debug' mode, it will exit on : | ||
# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the comments about this script especially focusing on difference of run.sh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if you make separated script, I think it is better to add all options in this scripts in order to train by just executing ./run_mfa.sh
.
set -e | ||
|
||
# If you are not using LJSpeech, be sure to define how your dataset is processed in mfa_format.py | ||
# Three | ||
|
||
#!/usr/bin/env bash | ||
# conda config --append channels conda-forge | ||
# conda install montreal-forced-aligner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -e | |
# If you are not using LJSpeech, be sure to define how your dataset is processed in mfa_format.py | |
# Three | |
#!/usr/bin/env bash | |
# conda config --append channels conda-forge | |
# conda install montreal-forced-aligner | |
#!/usr/bin/env bash | |
# Generate MFA alignement | |
# You need to install the following tools to run this script: | |
# $ conda config --append channels conda-forge | |
# $ conda install montreal-forced-aligner | |
# If you are not using LJSpeech, be sure to define how your | |
# dataset is processed in `scripts/utils/mfa_format.py`. | |
set -e |
|
||
|
||
# Run the below yourself | ||
|
||
#./run_mfa.sh --stage 0 --stop_stage 0 | ||
#./run_mfa.sh --stage 1 --stop_stage 1 | ||
#./run_mfa.sh --stage 2 --stop_stage 2 | ||
#./run_mfa.sh --stage 3 --stop_stage 3 | ||
#./run_mfa.sh --stage 4 --stop_stage 4 | ||
#./run_mfa.sh --stage 5 --stop_stage 5 \ | ||
# --train_config conf/tuning/train_fastspeech2.yaml \ | ||
# --teacher_dumpdir data \ | ||
# --tts_stats_dir data/stats \ | ||
# --write_collected_feats true | ||
#./run_mfa.sh --stage 6 --stop_stage 6 \ | ||
# --train_config conf/tuning/train_fastspeech2.yaml \ | ||
# --teacher_dumpdir data \ | ||
# --tts_stats_dir data/stats | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Run the below yourself | |
#./run_mfa.sh --stage 0 --stop_stage 0 | |
#./run_mfa.sh --stage 1 --stop_stage 1 | |
#./run_mfa.sh --stage 2 --stop_stage 2 | |
#./run_mfa.sh --stage 3 --stop_stage 3 | |
#./run_mfa.sh --stage 4 --stop_stage 4 | |
#./run_mfa.sh --stage 5 --stop_stage 5 \ | |
# --train_config conf/tuning/train_fastspeech2.yaml \ | |
# --teacher_dumpdir data \ | |
# --tts_stats_dir data/stats \ | |
# --write_collected_feats true | |
#./run_mfa.sh --stage 6 --stop_stage 6 \ | |
# --train_config conf/tuning/train_fastspeech2.yaml \ | |
# --teacher_dumpdir data \ | |
# --tts_stats_dir data/stats | |
echo "Successfully finished generating MFA alignments. | |
# NOTE(iamanigeeit): If you want to train FastSpeech2 with the alignments, | |
# please check `egs2/ljspeech/tts1/run_mfa.sh` as an example. |
''' | ||
This script converts files to/from MFA format for use in ESPnet TTS. | ||
If you wish to add functions to create .lab files for MFA, add them like this: | ||
`def make_labs_[dataset]: | ||
...` | ||
''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
''' | |
This script converts files to/from MFA format for use in ESPnet TTS. | |
If you wish to add functions to create .lab files for MFA, add them like this: | |
`def make_labs_[dataset]: | |
...` | |
''' | |
#!/usr/bin/env python3 | |
"""Convert files to/from MFA format for use in ESPnet TTS. | |
If you wish to add functions to create .lab files for MFA, add them like this: | |
def make_labs_[dataset]: | |
... | |
""" |
This pull request is now in conflict :( |
This pull request is now in conflict :( |
@kan-bayashi Sorry for the delay because of ICASSP submission. I will pull the latest version of ESPnet and fix my PR this week! |
� Conflicts: � README.md � espnet2/asr/encoder/wav2vec2_encoder.py � espnet2/asr/frontend/s3prl.py � espnet2/asr/postencoder/hugging_face_transformers_postencoder.py � espnet2/gan_tts/jets/jets.py � setup.py � test/espnet2/asr/frontend/test_s3prl.py
Hello @kan-bayashi I have made the requested changes, but i can't submit the PR, because i have modified other files for my own work on I tried to fork
What should i do? |
Thank you for your modification, @iamanigeeit.
I've never met this kind of error. Let me confirm your procedure.
Is it correct? |
This pull request is now in conflict :( |
Thanks @kan-bayashi Creating a new branch and making the PR from Github instead of Pycharm seems to work. The new commit is at #4801 |
From #4521 : this commit adds scripts necessary to convert MFA to ESPnet formats.
mfa.sh
automates the entire conversion processtts.sh
has been modified to pass arguments todata.sh
for MFAdata.sh
has been edited to produce required text and durations filesTo create .lab files for other datasets, define the relevant function in
mfa_format.py
.