microsoft / SpeechT5

Unified-Modal Speech-Text Pre-Training for Spoken Language Processing
MIT License
1.16k stars 113 forks source link

SpeechLM: how to prepare phoneme sequence for T2U generator #17

Closed cwang621 closed 1 year ago

cwang621 commented 1 year ago

Hi, I am trying to reproduce the T2U generator but have issues about converting asr transcripts to phoneme sequence. I think the phoneme sequence in dataset/LibriSpeech/fast_phone2units/genset_examples.tsv is not produced by speechlm/data_process/prepare_phn2ltr_librilm.sh. The phonemes in the former are not up-sampled and the probability of inserting silence is less than 0.25. Is there an example on how to prepare the phoneme sequence for T2U generator? Thanks.

zz12375 commented 1 year ago

1) You are right, the examples in genset_examples.tsv is not produced by prepare_phn2ltr_librilm.sh. (Actually prepare_phn2ltr_librilm.sh is organized ONLY for producing phone-letter data for pre-training SpeechLM-P model.) The difference is: The T2U generator uses 41 mono phones, while SpeechLM-P model uses 300+ word-position-dependent phones. (The former can be easily merged to the latter by Kaldi. This inconsistency is just due to the division of work among different people.)

2) The phonemes for the T2U generator are not up-sampled, because the T2U generator will predict the duration information. The probability of inserting silence was indeed set to 0.25. Note that the probability is "silence between words" instead of "silence between phones", so when you calculate the phones' probability, it is less than 0.25.

3) To prepare the phoneme sequence for the inference of the T2U generator, please use speechlm/data_process/phoneize_with_sil.py, with the input of a word-level text and a word-to-phone lexicon (see readme.md). e.g. python speechut/data_process/phoneize_with_sil.py -i librilm.wrd -o librilm.phn --lexicon lexicon.lst --surround -s 0.25

Hope the above information could help you.

cwang621 commented 1 year ago

Thanks a lot, that is really helpful. But I have another question. Phonemes need to be converted to idx (eg. AH B -> 1 2). This step is achieved through the vocabulary dict.PHN.txt. Would you mind sharing this PHN2phh vocabulary? dataset/LibriSpeech/fast_phone2unit only contains dict.km.txt and dict.phn.txt, which is not enough for generating genset_examples.tsv.

cwang621 commented 1 year ago

Thanks a lot, that is really helpful. But I have another question. Phonemes need to be converted to idx (eg. AH B -> 1 2). This step is achieved through the vocabulary dict.PHN.txt. Would you mind sharing this PHN2phh vocabulary? dataset/LibriSpeech/fast_phone2unit only contains dict.km.txt and dict.phn.txt, which is not enough for generating genset_examples.tsv.

I think The CMU Pronouncing Dictionary is required. There are no more questions.

zz12375 commented 1 year ago

Sorry for the late response. dataset/LibriSpeech/fast_phone2unit contains both dict.PHN.txt and dict.phn.txt, which stand for symbol and idx respectively. The two files are aligned line by line (e.g. the same line in two files means the same phones). So I think they are sufficient to convert the phone symbols generated by speechut/data_process/phoneize_with_sil.py to numerical IDs.

cwang621 commented 1 year ago

I found out why I can not find both dict.phn.txt and dict.PHN.txt in dataset/LibriSpeech/fast_phone2unit. This is because the suffix of the windows system is not case sensitive (dict.phn.txt and dict.PHN.txt are the same). When I download the code and unzip it on windows system, overwriting happens, but this problem does not happen on linux system. Thanks again for your response. I have reproduced the T2U generator successfully.