From 8472231c72d1b677575eca9a8d5cdba7f8b8a9be Mon Sep 17 00:00:00 2001 From: Yurii Paniv Date: Sun, 8 May 2022 20:16:49 +0300 Subject: [PATCH] Add improved "Mykyta" model with stress support --- .gitignore | 3 +- app.py | 12 +-- config.json | 197 +++++++++++++++++++++++++++++------------------ requirements.txt | 2 +- 4 files changed, 131 insertions(+), 83 deletions(-) diff --git a/.gitignore b/.gitignore index 17d0a39..aa1a140 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,5 @@ dmypy.json .pyre/ # model files -*.pth.tar \ No newline at end of file +*.pth.tar +*.pth \ No newline at end of file diff --git a/app.py b/app.py index 505f880..d2968b2 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from formatter import preprocess_text MODEL_NAMES = [ - "uk/mai/vits-tts" + "uk/mykyta/vits-tts" ] MODELS = {} @@ -28,11 +28,11 @@ def download(url, file_name): for MODEL_NAME in MODEL_NAMES: print(f"downloading {MODEL_NAME}") - release_number = "1.0.0" - model_link = f"https://github.com/robinhad/ukrainian-tts/releases/download/v{release_number}/model.pth.tar" - config_link = f"https://github.com/robinhad/ukrainian-tts/releases/download/v{release_number}/config.json" + release_number = "v2.0.0-beta" + model_link = f"https://github.com/robinhad/ukrainian-tts/releases/download/{release_number}/model.pth" + config_link = f"https://github.com/robinhad/ukrainian-tts/releases/download/{release_number}/config.json" - model_path = "model.pth.tar" + model_path = "model.pth" config_path = "config.json" download(model_link, model_path) @@ -74,7 +74,7 @@ def tts(text: str, model_name: str): outputs=gr.outputs.Audio(label="Output"), title="πŸΈπŸ’¬πŸ‡ΊπŸ‡¦ - Coqui TTS", theme="huggingface", - description="Π£ΠΊΡ€Π°Ρ—Π½ΠΎΠΌΠΎΠ²Π½ΠΈΠΉπŸ‡ΊπŸ‡¦ TTS Π·Π° допомогою Coqui TTS (для апострофа використовуйтС символ Ρƒ Ρ‚Ρ€ΠΈΠΊΡƒΡ‚Π½ΠΈΡ… Π΄ΡƒΠΆΠΊΠ°Ρ…: <'>)", + description="Π£ΠΊΡ€Π°Ρ—Π½ΠΎΠΌΠΎΠ²Π½ΠΈΠΉπŸ‡ΊπŸ‡¦ TTS Π·Π° допомогою Coqui TTS (для наголосу використовуйтС + ΠΏΠ΅Ρ€Π΅Π΄ голосною)", article="Π―ΠΊΡ‰ΠΎ Π²Π°ΠΌ ΠΏΠΎΠ΄ΠΎΠ±Π°Ρ”Ρ‚ΡŒΡΡ, ΠΏΡ–Π΄Ρ‚Ρ€ΠΈΠΌΠ°ΠΉΡ‚Π΅ Π·Π° посиланням: [SUPPORT LINK](https://send.monobank.ua/jar/48iHq4xAXm), " + "Github: [https://github.com/robinhad/ukrainian-tts](https://github.com/robinhad/ukrainian-tts)", ) diff --git a/config.json b/config.json index 0e0273c..06c6d91 100644 --- a/config.json +++ b/config.json @@ -1,32 +1,56 @@ { - "model": "vits", - "run_name": "vits_ljspeech", - "run_description": "", - "epochs": 1000, - "batch_size": 18, - "eval_batch_size": 16, - "mixed_precision": true, - "scheduler_after_epoch": true, - "run_eval": true, - "test_delay_epochs": -1, - "print_eval": true, - "dashboard_logger": "tensorboard", + "output_path": "./model", + "logger_uri": null, + "run_name": "vits_mykyta", + "project_name": null, + "run_description": "\ud83d\udc38Coqui trainer run.", "print_step": 25, "plot_step": 100, "model_param_stats": false, - "project_name": null, - "log_model_step": null, "wandb_entity": null, + "dashboard_logger": "tensorboard", + "log_model_step": null, "save_step": 10000, - "checkpoint": true, - "keep_all_best": false, - "keep_after": 10000, - "num_loader_workers": 12, - "num_eval_loader_workers": 12, - "use_noise_augment": false, - "output_path": "./ukrainian-vits", + "save_n_checkpoints": 5, + "save_checkpoints": true, + "save_all_best": false, + "save_best_after": 10000, + "target_loss": null, + "print_eval": false, + "test_delay_epochs": -1, + "run_eval": true, "distributed_backend": "nccl", "distributed_url": "tcp://localhost:54321", + "mixed_precision": true, + "epochs": 1000, + "batch_size": 32, + "eval_batch_size": 16, + "grad_clip": [ + 1000.0, + 1000.0 + ], + "scheduler_after_epoch": true, + "lr": 0.001, + "optimizer": "AdamW", + "optimizer_params": { + "betas": [ + 0.8, + 0.99 + ], + "eps": 1e-09, + "weight_decay": 0.01 + }, + "lr_scheduler": "", + "lr_scheduler_params": {}, + "use_grad_scaler": false, + "cudnn_enable": true, + "cudnn_deterministic": false, + "cudnn_benchmark": true, + "training_seed": 54321, + "model": "vits", + "num_loader_workers": 8, + "num_eval_loader_workers": 8, + "use_noise_augment": false, "audio": { "fft_size": 1024, "win_length": 1024, @@ -34,23 +58,27 @@ "frame_shift_ms": null, "frame_length_ms": null, "stft_pad_mode": "reflect", - "sample_rate": 16000, + "sample_rate": 48000, "resample": false, "preemphasis": 0.0, "ref_level_db": 20, - "do_sound_norm": false, - "log_func": "np.log", + "do_sound_norm": true, + "log_func": "np.log10", "do_trim_silence": true, "trim_db": 45, - "power": 1.3, + "do_rms_norm": false, + "db_level": null, + "power": 1.5, "griffin_lim_iters": 60, "num_mels": 80, "mel_fmin": 0.0, "mel_fmax": null, "spec_gain": 1, - "do_amp_to_db_linear": false, + "do_amp_to_db_linear": true, "do_amp_to_db_mel": true, - "signal_norm": false, + "pitch_fmax": 640.0, + "pitch_fmin": 0.0, + "signal_norm": true, "min_level_db": -100, "symmetric_norm": true, "max_norm": 4.0, @@ -58,68 +86,73 @@ "stats_path": null }, "use_phonemes": false, - "use_espeak_phonemes": true, - "phoneme_language": null, - "compute_input_seq_cache": true, + "phonemizer": null, + "phoneme_language": "uk", + "compute_input_seq_cache": false, "text_cleaner": "basic_cleaners", "enable_eos_bos_chars": false, "test_sentences_file": "", - "phoneme_cache_path": "./ukrainian/phoneme_cache", + "phoneme_cache_path": "./phoneme_cache", "characters": { - "pad": "_", - "eos": "~", - "bos": "^", - "characters": "!',-.:;?\u0410\u0411\u0412\u0413\u0490\u0414\u0415\u0404\u0416\u0417\u0418\u0406\u0407\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042c\u042e\u042f\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044c\u044e\u044f ", - "punctuations": "!',-.:;? ", + "characters_class": "TTS.tts.models.vits.VitsCharacters", + "vocab_dict": null, + "pad": "", + "eos": "", + "bos": "", + "blank": "", + "characters": "!\"'(),-/:;?\u00ab\u00bb+\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044c\u044e\u044f\u0454\u0456\u0457\u0491\u2013\u2014\u2015\u2018\u2019\u201c\u201d\u201e\u2026 ", + "punctuations": "!\"'(),-/:;?\u00ab\u00bb+\u2013\u2014\u2015\u2018\u2019\u201c\u201d\u201e\u2026 ", "phonemes": null, - "unique": true + "is_unique": true, + "is_sorted": true }, - "batch_group_size": 5, + "add_blank": true, + "batch_group_size": 0, "loss_masking": null, - "sort_by_audio_len": true, - "min_seq_len": 0, - "max_seq_len": 500000, + "sort_by_audio_len": false, + "min_audio_len": 24000, + "max_audio_len": 624000, + "min_text_len": 1, + "max_text_len": Infinity, "compute_f0": false, "compute_linear_spec": true, - "add_blank": true, + "precompute_num_workers": 8, + "start_by_longest": false, "datasets": [ { "name": "ljspeech", - "path": "./Data/uk_UK/by_book/female/sumska/kaydasheva", - "meta_file_train": "metadata.csv", - "ununsed_speakers": null, - "meta_file_val": "", - "meta_file_attn_mask": "" - }, - { - "name": "ljspeech", - "path": "./Data/uk_UK/by_book/female/sumska/mykola_djerya", + "path": "./dataset", "meta_file_train": "metadata.csv", - "ununsed_speakers": null, + "ignored_speakers": null, + "language": "", "meta_file_val": "", "meta_file_attn_mask": "" } ], - "optimizer": "AdamW", - "optimizer_params": { - "betas": [ - 0.8, - 0.99 - ], - "eps": 1e-09, - "weight_decay": 0.01 - }, - "lr_scheduler": "", - "lr_scheduler_params": {}, "test_sentences": [ - "\u0413\u043e\u0432\u043e\u0440\u0438 \u043d\u0456\u0431\u0438 \u0442\u0438 \u0436\u0438\u0432\u0438\u0439!", - "\u041f\u043e\u043b \u043f\u0435\u0440\u0435\u0442\u043d\u0443\u0432 \u043f\u0443\u0441\u0442\u0435\u043b\u044e", - "\u041f\u0440\u0438\u0432\u0456\u0442, \u0441\u0432\u0456\u0442\u0435!" + [ + "\u0413\u043e\u0432\u043e\u0440+\u0438, \u043d+\u0456\u0431\u0438 \u0442+\u0438 \u0436\u0438\u0432+\u0438\u0439!" + ], + [ + "\u041f\u0435\u0440\u0435\u043f\u0440+\u043e\u0448\u0443\u044e, \u0414+\u0435\u0439\u0432\u0435, \u043d+\u0430 \u0436+\u0430\u043b\u044c, +\u044f \u043d+\u0435 \u043c+\u043e\u0436\u0443 \u0437\u0440\u043e\u0431+\u0438\u0442\u0438 \u0446+\u0435." + ], + [ + "\u0425\u0442+\u043e \u0442+\u0438 \u0442\u0430\u043a+\u0438\u0439 +\u0456 +\u044f\u043a \u0442\u0435\u0431+\u0435 \u0437\u0432+\u0430\u0442\u0438?" + ], + [ + "\u041a+\u0430\u043c'\u044f\u043d+\u0435\u0446\u044c-\u041f\u043e\u0434+\u0456\u043b\u044c\u0441\u044c\u043a\u0438\u0439 - \u043c+\u0456\u0441\u0442\u043e \u0432 \u0425\u043c\u0435\u043b\u044c\u043d+\u0438\u0446\u044c\u043a\u0456\u0439 +\u043e\u0431\u043b\u0430\u0441\u0442\u0456 \u0423\u043a\u0440\u0430+\u0457\u043d\u0438, \u0446+\u0435\u043d\u0442\u0440 \u041a\u0430\u043c'\u044f\u043d+\u0435\u0446\u044c-\u041f\u043e\u0434+\u0456\u043b\u044c\u0441\u044c\u043a\u043e\u0457 \u043c\u0456\u0441\u044c\u043a+\u043e\u0457 \u043e\u0431'+\u0454\u0434\u043d\u0430\u043d\u043e\u0457 \u0442\u0435\u0440\u0438\u0442\u043e\u0440\u0456+\u0430\u043b\u044c\u043d\u043e\u0457 \u0433\u0440\u043e\u043c+\u0430\u0434\u0438 +\u0456 \u041a\u0430\u043c'\u044f\u043d+\u0435\u0446\u044c-\u041f\u043e\u0434+\u0456\u043b\u044c\u0441\u044c\u043a\u043e\u0433\u043e \u0440\u0430\u0439+\u043e\u043d\u0443." + ] ], + "eval_split_max_size": null, + "eval_split_size": 0.01, + "use_speaker_weighted_sampler": false, + "speaker_weighted_sampler_alpha": 1.0, + "use_language_weighted_sampler": false, + "language_weighted_sampler_alpha": 1.0, "model_args": { - "num_chars": 86, + "num_chars": 83, "out_channels": 513, - "spec_segment_size": 24, + "spec_segment_size": 32, "hidden_channels": 192, "hidden_channels_ffn_text_encoder": 768, "num_heads_text_encoder": 2, @@ -181,16 +214,25 @@ "use_speaker_embedding": false, "num_speakers": 0, "speakers_file": null, + "d_vector_file": null, "speaker_embedding_channels": 256, "use_d_vector_file": false, - "d_vector_file": null, "d_vector_dim": 0, - "detach_dp_input": true + "detach_dp_input": true, + "use_language_embedding": false, + "embedded_language_dim": 4, + "num_languages": 0, + "language_ids_file": null, + "use_speaker_encoder_as_loss": false, + "speaker_encoder_config_path": "", + "speaker_encoder_model_path": "", + "condition_dp_on_speaker": true, + "freeze_encoder": false, + "freeze_DP": false, + "freeze_PE": false, + "freeze_flow_decoder": false, + "freeze_waveform_decoder": false }, - "grad_clip": [ - 1000.0, - 1000.0 - ], "lr_gen": 0.0002, "lr_disc": 0.0002, "lr_scheduler_gen": "ExponentialLR", @@ -209,13 +251,18 @@ "feat_loss_alpha": 1.0, "mel_loss_alpha": 45.0, "dur_loss_alpha": 1.0, + "speaker_encoder_loss_alpha": 1.0, "return_wav": true, "r": 1, "num_speakers": 0, "use_speaker_embedding": false, "speakers_file": null, "speaker_embedding_channels": 256, + "language_ids_file": null, + "use_language_embedding": false, "use_d_vector_file": false, "d_vector_file": null, - "d_vector_dim": 0 + "d_vector_dim": 0, + "restore_path": "./vits_mykyta-May-06-2022_12+17AM-c410bc58/best_model_90901.pth", + "github_branch": "* (HEAD detached at v0.6.2)" } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0a2915d..8755303 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -TTS==0.4.1 +TTS==0.6.2 gradio \ No newline at end of file