Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "m_HkOd4jwqIb"
- },
- "source": [
- "Connect Google drive account"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "-RUb7_iJu1mb"
- },
- "outputs": [],
- "source": [
- "from google.colab import drive\n",
- "\n",
- "drive.mount(\"/content/drive\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "WIvwEf9zydzN"
- },
- "source": [
- "Download and Build Rnnoise and Requirements"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "1HigwgxZxEXf"
- },
- "outputs": [],
- "source": [
- "!pip install pyloudnorm\n",
- "!git clone https://github.com/xiph/rnnoise.git\n",
- "!sudo apt-get install curl autoconf automake libtool python-dev pkg-config sox\n",
- "%cd /content/rnnoise\n",
- "!sh autogen.sh\n",
- "!sh configure\n",
- "!make clean\n",
- "!make"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "Lyz3RjlYuXjz",
- "outputId": "effb28bd-2b59-4ddc-e391-52f534a35e54"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "usage: /content/rnnoise/examples/.libs/rnnoise_demo <noisy speech> <output denoised>\n"
- ]
- }
- ],
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "vWzQveIIy7QW"
- },
- "source": [
- "Install Coqui TTS"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "jyCWXW_2y_nx"
- },
- "outputs": [],
- "source": [
- "!sudo apt-get install espeak-ng\n",
- "!git clone https://github.com/coqui-ai/TTS.git\n",
- "%cd /content/TTS\n",
- "!pip install numpy==1.21.6\n",
- "!pip install black\n",
- "!pip install coverage\n",
- "!pip install isort\n",
- "!pip install nose\n",
- "!pip install pylint==2.10.2\n",
- "!pip install bokeh==1.4.0\n",
- "# core deps\n",
- "#!pip install numpy==1.19.5\n",
- "!pip install cython\n",
- "!pip install scipy>=1.4.0\n",
- "!pip install torch>=1.7\n",
- "!pip install torchaudio\n",
- "!pip install soundfile\n",
- "!pip install librosa==0.8.0\n",
- "!pip install numba==0.53\n",
- "!pip install inflect\n",
- "!pip install tqdm\n",
- "!pip install anyascii\n",
- "!pip install pyyaml\n",
- "!pip install fsspec>=2021.04.0\n",
- "# deps for examples\n",
- "!pip install flask\n",
- "# deps for inference\n",
- "!pip install pysbd\n",
- "# deps for notebooks\n",
- "!pip install umap-learn==0.5.1\n",
- "!pip install pandas\n",
- "# deps for training\n",
- "!pip install matplotlib\n",
- "!pip install tensorboardX\n",
- "!pip install pyworld\n",
- "# coqui stack\n",
- "!pip install trainer\n",
- "!pip install coqpit # config management\n",
- "# chinese g2p deps\n",
- "!pip install jieba\n",
- "!pip install pypinyin\n",
- "# japanese g2p deps\n",
- "!pip install mecab-python3==1.0.3\n",
- "!pip install unidic-lite==1.0.8\n",
- "# gruut+supported langs\n",
- "!pip install gruut[cs,de,es,fr,it,nl,pt,ru,sv]==2.2.3\n",
- "!pip install tf-estimator-nightly==2.8.0.dev2021122109\n",
- "#!pip install bokeh==2.3.0\n",
- "!pip install tensorflow==2.8.0\n",
- "!pip install panel==0.12.1\n",
- "!pip install folium==0.2.1\n",
- "!pip install datascience==0.10.6\n",
- "!pip install imgaug==0.2.6\n",
- "!pip install albumentations==0.1.12\n",
- "!pip install -e .[all,dev,notebooks] # Select the relevant extras\n",
- "!make system-deps\n",
- "!make install\n",
- "!pip install numpy==1.21.6\n",
- "!pip install TTS\n",
- "!tts --list_models"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "EX5ftK4TzPUD"
- },
- "source": [
- "Download VITS model and Generate Sample Wav File"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "Vy-BadvazVNM"
- },
- "outputs": [],
- "source": [
- "!tts --text \"I am the very model of a modern Major General\" --model_name \"tts_models/en/ljspeech/vits\" --out_path /content/drive/MyDrive/speech_out/ljspeech-vits.wav"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "uSthp75hzZvz"
- },
- "source": [
- "Process Audio Clips"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "xyV6G0mozcdk"
- },
- "outputs": [],
- "source": [
- "!python /content/drive/MyDrive/rnnoise.py /content/drive/MyDrive/original"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "XS08OyEVzeJA"
- },
- "source": [
- "Fine Tune VITS model"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "background_save": true
- },
- "id": "DviNKw7rzkyK"
- },
- "outputs": [],
- "source": [
- "!CUDA_VISIBLE_DEVICES=\"0\" python /content/drive/MyDrive/train-vits-bg-colab.py --restore_path /root/.local/share/tts/tts_models--en--ljspeech--vits/model_file.pth"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "uRa5mrGRlRc9"
- },
- "source": [
- "Generate Speech using Your Fined Tuned Model. Point the model_path to the checkpoint.pth file and the config_path to the config.json from the trainer output."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "BICjNNGulR2M"
- },
- "outputs": [],
- "source": [
- "!tts --text \"I am the very model of a modern Major General\" --config_path \"/content/drive/MyDrive/DIRECTORY/config.json\" --model_path \"/content/drive/MyDrive/DIRECTORY/MODELFILENAME.pth\" --out_path /content/drive/MyDrive/speech_out/words-vits.wav"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "IH0v8dCfng9U"
- },
- "source": [
- "Continue Training Run. \n",
- "Edit the path to reflect the training output from a previous run."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "PiM4XGXgnnIc"
- },
- "outputs": [],
- "source": [
- "!CUDA_VISIBLE_DEVICES=\"0\" python /content/drive/MyDrive/train-vits-bg-colab.py --restore_path /content/drive/MyDrive/DATASET-DIRECTORY/traineroutput/TRAINING_RUN/CHECKPOINTFILE.pth --config_path /content/drive/MyDrive/DATASET-DIRECTORY/traineroutput/TRAINING_RUN/config.json"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "UZ2WoSCqzqxH"
- },
- "source": [
- "View Memory Usage"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "ryma4sViztPk"
- },
- "outputs": [],
- "source": [
- "!nvidia-smi"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "-ORJUVXnz4B5"
- },
- "source": [
- "Load Tensorboard"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "J1gPy_jSz551"
- },
- "outputs": [],
- "source": [
- "import torch \n",
- "with torch.no_grad():\n",
- " torch.cuda.empty_cache()\n",
- "from __future__ import absolute_import, division, print_function, unicode_literals\n",
- "\n",
- "try:\n",
- " # %tensorflow_version only exists in Colab.\n",
- " %tensorflow_version 2.x\n",
- "except Exception:\n",
- " pass\n",
- " \n",
- "# Load the TensorBoard notebook extension\n",
- "%load_ext tensorboard"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "hkt32dP3z9sK"
- },
- "source": [
- "Load Dashboard"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "PxPBHCGf0AVt"
- },
- "outputs": [],
- "source": [
- "%tensorboard --logdir /content/drive/MyDrive/bg-dataset/traineroutput/"
- ]
- }
- ],
- "metadata": {
- "accelerator": "GPU",
- "colab": {
- "collapsed_sections": [],
- "name": "Voice Clone.ipynb",
- "provenance": []
- },
- "gpuClass": "standard",
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- },
- "language_info": {
- "name": "python"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement