Coder Social home page Coder Social logo

mixomo / efficient-vits-finetuning-spanish-support-wip- Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nivibilla/efficient-vits-finetuning

0.0 0.0 0.0 6.14 MB

Finetuning VITS Efficiently (Spanish support WIP)

License: MIT License

Python 94.74% Jupyter Notebook 4.43% Cython 0.83%

efficient-vits-finetuning-spanish-support-wip-'s Introduction

Making VITS efficient (wip) (spanish support wip)

For spanish preprocessing text:

python preprocess.py --text_index 1 --text_cleaners spanish_cleaners --filelists /path/to/train/filelist.txt /path/to/val/filelist.txt 

If you using and ocmpiling the most recent version of espeak-ng, you can preprocess the text in Latin American Spanish (if you want to train a voice with that dialect) using the following:

python preprocess.py --text_index 1 --text_cleaners spanish_cleaners2 --filelists /path/to/train/filelist.txt /path/to/val/filelist.txt 

if you get this warning when preprocessing, ignore it.

WARNING:phonemizer:words count mismatch on 100.0% of the lines (1/1)
WARNING:phonemizer:words count mismatch on 100.0% of the lines (1/1)
WARNING:phonemizer:words count mismatch on 100.0% of the lines (1/1)

For training, remember to update the configs/base_es_singlespeaker_22k.json or configs/base_es-latin_singlespeaker_22k file with the paths of your training and validation files, as well as model settings such as batch size and number of epochs to train. This depends of your dataset.

"name": "your_speaker_name",
    "training_files": "/path/to/train/filelist.txt",
    "validation_files": "/path/to/val/filelist.txt",

TRAINING IT´S NOW WORKING!

Start training with

python train.py -c configs/base_es_singlespeaker_22k.json -m "voice_name" -p "output_path/to/save"

Goals

  • Try to implement LoRA Finetuning on VITS by modifying attentions.py as described in the LoRA Paper
    • Doesnt work as the generator doesnt get updated, need to research more
  • Try to implement 8-bit training using bitsandbytes to reduce vram usage
    • 8 bit optimisers
  • Write paper explaining steps?

Plan

  • Extract discriminator from hifigan
  • Modify models.py to match hifigan implementation
  • Make sure training loop runs
  • Clean up logging, maybe integrate WandB to track training progress
    • WandB integrated! Run train_wandb.py to use it
  • Test finetune as-is on test dataset to make sure patched discriminator works
    • Wont be releasing weights for the optimusPrime as model is not good. See w&b report underneath
    • Will be trying to train with a better dataset to showcase the finetune
  • implement LoRA
  • Test finetune on lora using same test dataset
  • Implement 8-bit optimizers
  • Create webpage to show results (see w&b report)

Finetuning and Pretrained Models

  • The generator for LJSpeech is here
  • The discriminator(extracted from hifi-gan) is here
  • A notebook with a running training loop is here
  • W&B Report on finetuning with 8bit optimisers

8 bit AdamW

VITS at training with 8bit AdamW

By using 8bit AdamW for the loss. The training now uses approx 8.5gb of vram, wheras before it was using 12gb!!

Ethical Concerns

  • I realise that if this works, anyone remotely knowledgeable about machine learning will be able to finetune VITS on large datasets quite quickly to achieve pretty good voice cloning. However, this is already a thing(tortoise-tts: mrq fork, DLAS fork), but it takes a long time to finetune and generate.
  • However, sparks of efficient finetuning for TTS systems are already here, its only a matter of time before someone like me will do it for other models.
  • My initial plan is to only provide a comparison of results, and any good and ethical finetunes. I believe the real value lies in the dataset creation so will not be opensourcing any scripts to clean and curate the data.

Readme from Original Repo

VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech

Jaehyeon Kim, Jungil Kong, and Juhee Son

In our recent paper, we propose VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech.

Several recent end-to-end text-to-speech (TTS) models enabling single-stage training and parallel sampling have been proposed, but their sample quality does not match that of two-stage TTS systems. In this work, we present a parallel end-to-end TTS method that generates more natural sounding audio than current two-stage models. Our method adopts variational inference augmented with normalizing flows and an adversarial training process, which improves the expressive power of generative modeling. We also propose a stochastic duration predictor to synthesize speech with diverse rhythms from input text. With the uncertainty modeling over latent variables and the stochastic duration predictor, our method expresses the natural one-to-many relationship in which a text input can be spoken in multiple ways with different pitches and rhythms. A subjective human evaluation (mean opinion score, or MOS) on the LJ Speech, a single speaker dataset, shows that our method outperforms the best publicly available TTS systems and achieves a MOS comparable to ground truth.

Visit our demo for audio samples.

We also provide the pretrained models.

** Update note: Thanks to Rishikesh (ऋषिकेश), our interactive TTS demo is now available on Colab Notebook.

VITS at training VITS at inference
VITS at training VITS at inference

Pre-requisites

  1. Python >= 3.6
  2. Clone this repository
  3. Install python requirements. Please refer requirements.txt
    1. You may need to install espeak first: apt-get install espeak-ng
  4. Download datasets
    1. Download and extract the LJ Speech dataset, then rename or create a link to the dataset folder: ln -s /path/to/LJSpeech-1.1/wavs DUMMY1
    2. For mult-speaker setting, download and extract the VCTK dataset, and downsample wav files to 22050 Hz. Then rename or create a link to the dataset folder: ln -s /path/to/VCTK-Corpus/downsampled_wavs DUMMY2
  5. Build Monotonic Alignment Search and run preprocessing if you use your own datasets.
# Cython-version Monotonoic Alignment Search
cd monotonic_align
python setup.py build_ext --inplace

# Preprocessing (g2p) for your own datasets. Preprocessed phonemes for LJ Speech and VCTK have been already provided.
# python preprocess.py --text_index 1 --filelists filelists/ljs_audio_text_train_filelist.txt filelists/ljs_audio_text_val_filelist.txt filelists/ljs_audio_text_test_filelist.txt 
# python preprocess.py --text_index 2 --filelists filelists/vctk_audio_sid_text_train_filelist.txt filelists/vctk_audio_sid_text_val_filelist.txt filelists/vctk_audio_sid_text_test_filelist.txt

Training Exmaple

# LJ Speech
python train.py -c configs/ljs_base.json -m ljs_base

# VCTK
python train_ms.py -c configs/vctk_base.json -m vctk_base

Inference Example

See inference.ipynb

efficient-vits-finetuning-spanish-support-wip-'s People

Contributors

nivibilla avatar rmcpantoja avatar jaywalnut310 avatar mixomo avatar jik876 avatar juheeuu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.