이 저장소에는 Pytorch 21.02-Py3 NGC 컨테이너를 확장하고 일부 종속성을 캡슐화하는 Dockerfile이 포함되어 있습니다. 나만의 컨테이너를 만들려면 Nvidia Pytorch 컨테이너 버전에서 Pytorch 컨테이너를 선택하고 다음 형식으로 Dockerfile을 만듭니다.
FROM nvcr . io / nvidia / pytorch : 21.02 - py3
WORKDIR / path / to / working / directory / text2speech /
COPY requirements . txt .
RUN pip install - r requirements . txt /path/to/working/directory/text2speech/docker 로 이동하십시오
$ docker build - - no - cache - t torcht2s .
$ docker run - it - - rm - - gpus all - p 2222 : 8888 - v / path / to / working / directory / text2speech : / path / to / working / directory / text2speech torcht2s$ python - m ipykernel install - - user - - name = torcht2s
$ jupyter notebook - - ip = 0.0 . 0.0 - - port = 8888 - - no - browser - - allow - roothttp://127.0.0.1:2222/?token=${TOKEN} 으로 이동하고 터미널에 지정된 토큰을 입력하십시오.음성 합성 모델을 훈련시키기 위해서는 소리를 표현하는 소리와 음소 시퀀스가 필요합니다. 첫 번째 단계에서는 WYH입니다. 입력 텍스트는 기호 목록으로 인코딩됩니다. 이 연구에서 우리는 터키 캐릭터와 음소를 상징으로 사용합니다. 터키는 음성 언어이기 때문에 단어가 읽을 때 표현됩니다. 즉, 캐릭터 시퀀스는 터키어로 구성된 단어입니다. 영어와 같은 비 신성한 언어에서 단어는 전화로 표현 될 수 있습니다. 영어 데이터로 터키어 연설을 종합하려면 영어 데이터 세트의 단어는 먼저 터키로 변환되어야합니다.
valid_symbols = [ '1' , '1:' , '2' , '2:' , '5' , 'a' , 'a:' , 'b' , 'c' , 'd' , 'dZ' , 'e' , 'e:' , 'f' , 'g' , 'gj' , 'h' , 'i' , 'i:' , 'j' ,
'k' , 'l' , 'm' , 'n' , 'N' , 'o' , 'o:' , 'p' , 'r' , 's' , 'S' , 't' , 'tS' , 'u' , 'u' , 'v' , 'y' , 'y:' , 'z' , 'Z' ]속도를 높이기 위해서는 사전 처리 단계에서 생성 될 수 있으며 훈련 중에 디스크에서 직접 읽을 수 있습니다. 다음 단계에 따라 사용자 정의 데이터 세트를 사용하십시오.
text2speech/Fastpitch/dataset/ Location에서 .wav 파일로의 경로와 경로. 해당 파일리스트는 라인 당 단일 발화를 다음과 같이 나열해야합니다. < audio file path > | < transcript >text2speech/Fastpitch/data_preperation.ipynb 로 피치 및 MEL을 계산하십시오. $ python prepare_dataset . py
- - wav - text - filelists dataset / tts_data . txt
- - n - workers 16
- - batch - size 1
- - dataset - path dataset
- - extract - pitch
- - f0 - method pyin
- - extract - mels text2speech/Fastpitch/data_preperation.ipynb 에서 create_picth_text_file(manifest_path) 에서 사전 계산 된 피치를 실행하는 경로가있는 파일 목록 준비 : 해당 파일리스트는 다음과 같이 하나의 발언을 나열해야합니다. < mel or wav file path > | < pitch file path > | < text > | < speaker_id >전체 데이터 세트에는 다음과 같은 구조가 있습니다.
. / dataset
├── mels
├── pitch
├── wavs
├── tts_data . txt # train + val
├── tts_data_train . txt
├── tts_data_val . txt
├── tts_pitch_data . txt # train + val
├── tts_pitch_data_train . txt
├── tts_pitch_data_val . txt 이 교육은 원시 텍스트에서 멜 스피어 그램을 생성 할 수있는 빠른 피치 모델을 생성합니다. 일련의 중간 체크 포인트와 함께 단일 .pt 체크 포인트 파일로 직렬화됩니다.
$ python train . py - - cuda - - amp - - p - arpabet 1.0 - - dataset - path dataset
- - output saved_fastpicth_models /
- - training - files dataset / tts_pitch_data_train . txt
- - validation - files dataset / tts_pitch_data_val . txt
- - epochs 1000 - - learning - rate 0.001 - - batch - size 32
- - load - pitch - from - disk마지막 단계는 스펙트로 그램을 파형으로 변환하는 것입니다. 스펙트로 그램에서 음성을 생성하는 프로세스를 보코더라고도합니다.
일부 Mel-spectrogram 생성기는 모델 바이어스가 발생하기 쉽습니다. 스펙트로 그램이 Hifi-Gan이 훈련 된 실제 데이터와 다르므로 생성 된 오디오의 품질이 어려울 수 있습니다. 이 문제를 극복하기 위해,이 편향에 적응하기 위해 특정 Mel-spectrogram 생성기의 출력에 대해 Hifi-Gan 모델을 미세 조정할 수 있습니다. 이 섹션에서는 Fastpitch 출력에 대한 미세 조정을 수행합니다.
text2speech/Hifigan/data/pretrained_fastpicth_model/ directory에서 가장 성능이 좋은 FastPitch 출력 .pt 파일을 복사하십시오.text2speech/Hifigan/data/ directory에서 manifest manifest 파일 tts_pitch_data.txt 복사하십시오. $ python extract_mels . py - - cuda
- o data / mels - fastpitch - tr22khz
- - dataset - path / text2speech / Fastpitch / dataset
- - dataset - files data / tts_pitch_data . txt # train + val
- - load - pitch - from - disk
- - checkpoint - path data / pretrained_fastpicth_model / FastPitch_checkpoint . pt - bs 16 이제 Mel-Spectrograms는 text2speech/Hifigan/data/mels-fastpitch-tr22khz 디렉토리에서 준비해야합니다. 미세 조정 스크립트는 기존 Hifi-Gan 모델을로드하고 마지막 단계에서 생성 된 스펙트로 그램을 사용하여 여러 훈련을 실행합니다.
이 단계는 특정 Fastpitch 모델에 미세 조정 된 또 다른 .pt hifi-gan 모델 체크 포인트 파일을 생성합니다.
text2speech/Hifigan 디렉토리에서 새 폴더 results 엽니 다. $ nohup python train . py - - cuda - - output / results / hifigan_tr22khz
- - epochs 1000 - - dataset_path / Fastpitch / dataset
- - input_mels_dir / data / mels - fastpitch - tr22khz
- - training_files / Fastpitch / dataset / tts_data . txt
- - validation_files / Fastpitch / dataset / tts_data . txt
- - fine_tuning - - fine_tune_lr_factor 3 - - batch_size 16
- - learning_rate 0.0003 - - lr_decay 0.9998 - - validation_interval 10 > log . txt$ tail - f log . txt Mel-Spectrogram Generator를 사용하여 RAW 텍스트에서 오디오를 합성하려면 다음 명령을 실행하십시오.
python inference . py - - cuda
- - hifigan / Hifigan / results / hifigan_tr22khz / hifigan_gen_checkpoint . pt
- - fastpitch / Fastpitch / saved_fastpicth_models / FastPitch_checkpoint . pt
- i test_text . txt
- o wavs / 연설은 -i 인수와 함께 전달 된 파일에서 생성됩니다. 출력 오디오는 -o 인수에 의해 지정된 경로에 저장됩니다.