MCPcopy Index your code
hub / github.com/enhuiz/vall-e

github.com/enhuiz/vall-e @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
118 symbols 346 edges 16 files 14 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

VALL-E

An unofficial PyTorch implementation of VALL-E, based on the EnCodec tokenizer.

"Buy Me A Coffee"

Get Started

A toy Google Colab example: Open In Colab. Please note that this example overfits a single utterance under the data/test and is not usable. The pretrained model is yet to come.

Requirements

Since the trainer is based on DeepSpeed, you will need to have a GPU that DeepSpeed has developed and tested against, as well as a CUDA or ROCm compiler pre-installed to install this package.

Install

pip install git+https://github.com/enhuiz/vall-e

Or you may clone by:

git clone --recurse-submodules https://github.com/enhuiz/vall-e.git

Note that the code is only tested under Python 3.10.7.

Train

  1. Put your data into a folder, e.g. data/your_data. Audio files should be named with the suffix .wav and text files with .normalized.txt.

  2. Quantize the data:

python -m vall_e.emb.qnt data/your_data
  1. Generate phonemes based on the text:
python -m vall_e.emb.g2p data/your_data
  1. Customize your configuration by creating config/your_data/ar.yml and config/your_data/nar.yml. Refer to the example configs in config/test and vall_e/config.py for details. You may choose different model presets, check vall_e/vall_e/__init__.py.

  2. Train the AR or NAR model using the following scripts:

python -m vall_e.train yaml=config/your_data/ar_or_nar.yml

You may quit your training any time by just typing quit in your CLI. The latest checkpoint will be automatically saved.

Export

Both trained models need to be exported to a certain path. To export either of them, run:

python -m vall_e.export zoo/ar_or_nar.pt yaml=config/your_data/ar_or_nar.yml

This will export the latest checkpoint.

Synthesis

python -m vall_e <text> <ref_path> <out_path> --ar-ckpt zoo/ar.pt --nar-ckpt zoo/nar.pt

TODO

  • [x] AR model for the first quantizer
  • [x] Audio decoding from tokens
  • [x] NAR model for the rest quantizers
  • [x] Trainers for both models
  • [x] Implement AdaLN for NAR model.
  • [x] Sample-wise quantization level sampling for NAR training.
  • [ ] Pre-trained checkpoint and demos on LibriTTS
  • [x] Synthesis CLI

Notice

  • EnCodec is licensed under CC-BY-NC 4.0. If you use the code to generate audio quantization or perform decoding, it is important to adhere to the terms of their license.

Citations

@article{wang2023neural,
  title={Neural Codec Language Models are Zero-Shot Text to Speech Synthesizers},
  author={Wang, Chengyi and Chen, Sanyuan and Wu, Yu and Zhang, Ziqiang and Zhou, Long and Liu, Shujie and Chen, Zhuo and Liu, Yanqing and Wang, Huaming and Li, Jinyu and others},
  journal={arXiv preprint arXiv:2301.02111},
  year={2023}
}
@article{defossez2022highfi,
  title={High Fidelity Neural Audio Compression},
  author={Défossez, Alexandre and Copet, Jade and Synnaeve, Gabriel and Adi, Yossi},
  journal={arXiv preprint arXiv:2210.13438},
  year={2022}
}

Core symbols most depended-on inside this repo

get_spkr
called by 5
vall_e/config.py
sample
called by 3
vall_e/sampler.py
_get_phones
called by 3
vall_e/data.py
_create_dataloader
called by 3
vall_e/data.py
create_train_val_dataloader
called by 3
vall_e/data.py
_samplewise_merge_tensors
called by 3
vall_e/vall_e/base.py
run_eval
called by 2
vall_e/train.py
_replace_file_extension
called by 2
vall_e/data.py

Shape

Method 64
Function 41
Class 13

Languages

Python100%

Modules by API surface

vall_e/vall_e/base.py38 symbols
vall_e/data.py25 symbols
vall_e/vall_e/ar.py11 symbols
vall_e/vall_e/nar.py8 symbols
vall_e/emb/qnt.py8 symbols
vall_e/config.py7 symbols
vall_e/train.py5 symbols
vall_e/sampler.py5 symbols
vall_e/emb/g2p.py4 symbols
setup.py2 symbols
scripts/plot.py2 symbols
vall_e/vall_e/__init__.py1 symbols

For agents

$ claude mcp add vall-e \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact