{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "vakyansh_tts_demo.ipynb", "provenance": [], "authorship_tag": "ABX9TyNhhwduU9+eajfOP6r1Y98A", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "source": [ "## Installing Dependencies" ], "metadata": { "id": "oyoFPN29HrRt" } }, { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "5x4wJQGUaysK", "outputId": "90d49030-311e-4100-b42a-3849df217887" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Cloning into 'vakyansh-tts'...\n", "remote: Enumerating objects: 466, done.\u001b[K\n", "remote: Counting objects: 100% (201/201), done.\u001b[K\n", "remote: Compressing objects: 100% (175/175), done.\u001b[K\n", "remote: Total 466 (delta 89), reused 64 (delta 22), pack-reused 265\u001b[K\n", "Receiving objects: 100% (466/466), 259.27 KiB | 1.39 MiB/s, done.\n", "Resolving deltas: 100% (229/229), done.\n", "Processing /content/vakyansh-tts/src/glow_tts/monotonic_align\n", "\u001b[33m DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.\n", " pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.\u001b[0m\n", " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", " Preparing wheel metadata ... \u001b[?25l\u001b[?25hdone\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from monotonic-align==1.1) (1.19.5)\n", "Building wheels for collected packages: monotonic-align\n", " Building wheel for monotonic-align (PEP 517) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for monotonic-align: filename=monotonic_align-1.1-cp37-cp37m-linux_x86_64.whl size=237012 sha256=3ffba87629daf17ecf86f538ead38094792d74d16b36cf691371c36f2e2c8ead\n", " Stored in directory: /tmp/pip-ephem-wheel-cache-m1jlgsel/wheels/3a/e4/2d/953a66d439600fcb1836ffba5ef6915b944df396e8228909cb\n", "Successfully built monotonic-align\n", "Installing collected packages: monotonic-align\n", "Successfully installed monotonic-align-1.1\n", "running bdist_wheel\n", "running build\n", "running build_py\n", "creating build\n", "creating build/lib\n", "creating build/lib/tts_infer\n", "copying tts_infer/tts.py -> build/lib/tts_infer\n", "copying tts_infer/num_to_word_on_sent.py -> build/lib/tts_infer\n", "copying tts_infer/transliterate.py -> build/lib/tts_infer\n", "copying tts_infer/__init__.py -> build/lib/tts_infer\n", "running egg_info\n", "creating vakyansh_tts.egg-info\n", "writing vakyansh_tts.egg-info/PKG-INFO\n", "writing dependency_links to vakyansh_tts.egg-info/dependency_links.txt\n", "writing requirements to vakyansh_tts.egg-info/requires.txt\n", "writing top-level names to vakyansh_tts.egg-info/top_level.txt\n", "writing manifest file 'vakyansh_tts.egg-info/SOURCES.txt'\n", "adding license file 'LICENSE.md'\n", "writing manifest file 'vakyansh_tts.egg-info/SOURCES.txt'\n", "copying tts_infer/requirements.txt -> build/lib/tts_infer\n", "installing to build/bdist.linux-x86_64/wheel\n", "running install\n", "running install_lib\n", "creating build/bdist.linux-x86_64\n", "creating build/bdist.linux-x86_64/wheel\n", "creating build/bdist.linux-x86_64/wheel/tts_infer\n", "copying build/lib/tts_infer/tts.py -> build/bdist.linux-x86_64/wheel/tts_infer\n", "copying build/lib/tts_infer/num_to_word_on_sent.py -> build/bdist.linux-x86_64/wheel/tts_infer\n", "copying build/lib/tts_infer/transliterate.py -> build/bdist.linux-x86_64/wheel/tts_infer\n", "copying build/lib/tts_infer/__init__.py -> build/bdist.linux-x86_64/wheel/tts_infer\n", "copying build/lib/tts_infer/requirements.txt -> build/bdist.linux-x86_64/wheel/tts_infer\n", "running install_egg_info\n", "Copying vakyansh_tts.egg-info to build/bdist.linux-x86_64/wheel/vakyansh_tts-0.0.1-py3.7.egg-info\n", "running install_scripts\n", "adding license file \"LICENSE.md\" (matched pattern \"LICEN[CS]E*\")\n", "creating build/bdist.linux-x86_64/wheel/vakyansh_tts-0.0.1.dist-info/WHEEL\n", "creating 'dist/vakyansh_tts-0.0.1-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it\n", "adding 'tts_infer/__init__.py'\n", "adding 'tts_infer/num_to_word_on_sent.py'\n", "adding 'tts_infer/requirements.txt'\n", "adding 'tts_infer/transliterate.py'\n", "adding 'tts_infer/tts.py'\n", "adding 'vakyansh_tts-0.0.1.dist-info/LICENSE.md'\n", "adding 'vakyansh_tts-0.0.1.dist-info/METADATA'\n", "adding 'vakyansh_tts-0.0.1.dist-info/WHEEL'\n", "adding 'vakyansh_tts-0.0.1.dist-info/top_level.txt'\n", "adding 'vakyansh_tts-0.0.1.dist-info/RECORD'\n", "removing build/bdist.linux-x86_64/wheel\n", "Obtaining file:///content/vakyansh-tts\n", "Requirement already satisfied: Cython==0.29.24 in /usr/local/lib/python3.7/dist-packages (from vakyansh-tts==0.0.1) (0.29.24)\n", "Collecting inflect==5.3.0\n", " Downloading inflect-5.3.0-py3-none-any.whl (32 kB)\n", "Collecting layers==0.1.5\n", " Downloading layers-0.1.5.tar.gz (5.5 kB)\n", "Requirement already satisfied: librosa==0.8.1 in /usr/local/lib/python3.7/dist-packages (from vakyansh-tts==0.0.1) (0.8.1)\n", "Collecting matplotlib==3.3.4\n", " Downloading matplotlib-3.3.4-cp37-cp37m-manylinux1_x86_64.whl (11.5 MB)\n", "\u001b[K |████████████████████████████████| 11.5 MB 11.3 MB/s \n", "\u001b[?25hRequirement already satisfied: numpy==1.19.5 in /usr/local/lib/python3.7/dist-packages (from vakyansh-tts==0.0.1) (1.19.5)\n", "Collecting scipy==1.5.4\n", " Downloading scipy-1.5.4-cp37-cp37m-manylinux1_x86_64.whl (25.9 MB)\n", "\u001b[K |████████████████████████████████| 25.9 MB 1.2 MB/s \n", "\u001b[?25hCollecting tensorboardX==2.4\n", " Downloading tensorboardX-2.4-py2.py3-none-any.whl (124 kB)\n", "\u001b[K |████████████████████████████████| 124 kB 57.6 MB/s \n", "\u001b[?25hRequirement already satisfied: tensorboard==2.7.0 in /usr/local/lib/python3.7/dist-packages (from vakyansh-tts==0.0.1) (2.7.0)\n", "Collecting torch==1.5.1\n", " Downloading torch-1.5.1-cp37-cp37m-manylinux1_x86_64.whl (753.2 MB)\n", "\u001b[K |████████████████████████████████| 753.2 MB 13 kB/s \n", "\u001b[?25hCollecting Unidecode==1.3.2\n", " Downloading Unidecode-1.3.2-py3-none-any.whl (235 kB)\n", "\u001b[K |████████████████████████████████| 235 kB 65.7 MB/s \n", "\u001b[?25hRequirement already satisfied: tqdm==4.62.3 in /usr/local/lib/python3.7/dist-packages (from vakyansh-tts==0.0.1) (4.62.3)\n", "Collecting fastapi==0.70.0\n", " Downloading fastapi-0.70.0-py3-none-any.whl (51 kB)\n", "\u001b[K |████████████████████████████████| 51 kB 706 kB/s \n", "\u001b[?25hCollecting uvicorn==0.15.0\n", " Downloading uvicorn-0.15.0-py3-none-any.whl (54 kB)\n", "\u001b[K |████████████████████████████████| 54 kB 3.2 MB/s \n", "\u001b[?25hCollecting gradio==2.5.2\n", " Downloading gradio-2.5.2-py3-none-any.whl (982 kB)\n", "\u001b[K |████████████████████████████████| 982 kB 61.2 MB/s \n", "\u001b[?25hCollecting wavio==0.0.4\n", " Downloading wavio-0.0.4-py2.py3-none-any.whl (9.0 kB)\n", "Collecting pydload==1.0.9\n", " Downloading pydload-1.0.9-py2.py3-none-any.whl (16 kB)\n", "Collecting pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2\n", " Downloading pydantic-1.9.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.9 MB)\n", "\u001b[K |████████████████████████████████| 10.9 MB 35.1 MB/s \n", "\u001b[?25hCollecting starlette==0.16.0\n", " Downloading starlette-0.16.0-py3-none-any.whl (61 kB)\n", "\u001b[K |████████████████████████████████| 61 kB 298 kB/s \n", "\u001b[?25hCollecting Flask-Login\n", " Downloading Flask_Login-0.5.0-py2.py3-none-any.whl (16 kB)\n", "Collecting flask-cachebuster\n", " Downloading Flask-CacheBuster-1.0.0.tar.gz (3.1 kB)\n", "Collecting ffmpy\n", " Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n", "Collecting pydub\n", " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", "Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from gradio==2.5.2->vakyansh-tts==0.0.1) (1.1.5)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from gradio==2.5.2->vakyansh-tts==0.0.1) (2.23.0)\n", "Requirement already satisfied: Flask>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from gradio==2.5.2->vakyansh-tts==0.0.1) (1.1.4)\n", "Collecting Flask-Cors>=3.0.8\n", " Downloading Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB)\n", "Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from gradio==2.5.2->vakyansh-tts==0.0.1) (7.1.2)\n", "Collecting markdown2\n", " Downloading markdown2-2.4.2-py2.py3-none-any.whl (34 kB)\n", "Collecting analytics-python\n", " Downloading analytics_python-1.4.0-py2.py3-none-any.whl (15 kB)\n", "Collecting paramiko\n", " Downloading paramiko-2.9.1-py2.py3-none-any.whl (210 kB)\n", "\u001b[K |████████████████████████████████| 210 kB 61.1 MB/s \n", "\u001b[?25hCollecting pycryptodome\n", " Downloading pycryptodome-3.12.0-cp35-abi3-manylinux2010_x86_64.whl (2.0 MB)\n", "\u001b[K |████████████████████████████████| 2.0 MB 42.3 MB/s \n", "\u001b[?25hRequirement already satisfied: PyYaml in /usr/local/lib/python3.7/dist-packages (from layers==0.1.5->vakyansh-tts==0.0.1) (3.13)\n", "Collecting bashutils\n", " Downloading Bashutils-0.0.4.tar.gz (4.2 kB)\n", "Requirement already satisfied: resampy>=0.2.2 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (0.2.2)\n", "Requirement already satisfied: pooch>=1.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (1.5.2)\n", "Requirement already satisfied: numba>=0.43.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (0.51.2)\n", "Requirement already satisfied: audioread>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (2.1.9)\n", "Requirement already satisfied: scikit-learn!=0.19.0,>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (1.0.1)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (21.3)\n", "Requirement already satisfied: soundfile>=0.10.2 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (0.10.3.post1)\n", "Requirement already satisfied: joblib>=0.14 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (1.1.0)\n", "Requirement already satisfied: decorator>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.1->vakyansh-tts==0.0.1) (4.4.2)\n", "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.3.4->vakyansh-tts==0.0.1) (3.0.6)\n", "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.3.4->vakyansh-tts==0.0.1) (2.8.2)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.3.4->vakyansh-tts==0.0.1) (0.11.0)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.3.4->vakyansh-tts==0.0.1) (1.3.2)\n", "Requirement already satisfied: progressbar2 in /usr/local/lib/python3.7/dist-packages (from pydload==1.0.9->vakyansh-tts==0.0.1) (3.38.0)\n", "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from starlette==0.16.0->fastapi==0.70.0->vakyansh-tts==0.0.1) (3.10.0.2)\n", "Collecting anyio<4,>=3.0.0\n", " Downloading anyio-3.4.0-py3-none-any.whl (78 kB)\n", "\u001b[K |████████████████████████████████| 78 kB 7.8 MB/s \n", "\u001b[?25hRequirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (3.3.6)\n", "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.4.6)\n", "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.6.1)\n", "Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (3.17.3)\n", "Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.12.0)\n", "Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.42.0)\n", "Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.37.0)\n", "Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.0.1)\n", "Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.35.0)\n", "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (57.4.0)\n", "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.8.0)\n", "Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from torch==1.5.1->vakyansh-tts==0.0.1) (0.16.0)\n", "Collecting asgiref>=3.4.0\n", " Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)\n", "Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.7/dist-packages (from uvicorn==0.15.0->vakyansh-tts==0.0.1) (7.1.2)\n", "Collecting h11>=0.8\n", " Downloading h11-0.12.0-py3-none-any.whl (54 kB)\n", "\u001b[K |████████████████████████████████| 54 kB 3.7 MB/s \n", "\u001b[?25hRequirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.4->tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.15.0)\n", "Collecting sniffio>=1.1\n", " Downloading sniffio-1.2.0-py3-none-any.whl (10 kB)\n", "Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.7/dist-packages (from anyio<4,>=3.0.0->starlette==0.16.0->fastapi==0.70.0->vakyansh-tts==0.0.1) (2.10)\n", "Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio==2.5.2->vakyansh-tts==0.0.1) (1.1.0)\n", "Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio==2.5.2->vakyansh-tts==0.0.1) (2.11.3)\n", "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard==2.7.0->vakyansh-tts==0.0.1) (4.8)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.2.8)\n", "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard==2.7.0->vakyansh-tts==0.0.1) (4.2.4)\n", "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard==2.7.0->vakyansh-tts==0.0.1) (1.3.0)\n", "Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->Flask>=1.1.1->gradio==2.5.2->vakyansh-tts==0.0.1) (2.0.1)\n", "Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard==2.7.0->vakyansh-tts==0.0.1) (4.8.2)\n", "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard==2.7.0->vakyansh-tts==0.0.1) (3.6.0)\n", "Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /usr/local/lib/python3.7/dist-packages (from numba>=0.43.0->librosa==0.8.1->vakyansh-tts==0.0.1) (0.34.0)\n", "Requirement already satisfied: appdirs in /usr/local/lib/python3.7/dist-packages (from pooch>=1.0->librosa==0.8.1->vakyansh-tts==0.0.1) (1.4.4)\n", "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard==2.7.0->vakyansh-tts==0.0.1) (0.4.8)\n", "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->gradio==2.5.2->vakyansh-tts==0.0.1) (3.0.4)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->gradio==2.5.2->vakyansh-tts==0.0.1) (2021.10.8)\n", "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->gradio==2.5.2->vakyansh-tts==0.0.1) (1.24.3)\n", "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard==2.7.0->vakyansh-tts==0.0.1) (3.1.1)\n", "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn!=0.19.0,>=0.14.0->librosa==0.8.1->vakyansh-tts==0.0.1) (3.0.0)\n", "Requirement already satisfied: cffi>=1.0 in /usr/local/lib/python3.7/dist-packages (from soundfile>=0.10.2->librosa==0.8.1->vakyansh-tts==0.0.1) (1.15.0)\n", "Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.0->soundfile>=0.10.2->librosa==0.8.1->vakyansh-tts==0.0.1) (2.21)\n", "Collecting monotonic>=1.5\n", " Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB)\n", "Collecting backoff==1.10.0\n", " Downloading backoff-1.10.0-py2.py3-none-any.whl (31 kB)\n", "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->gradio==2.5.2->vakyansh-tts==0.0.1) (2018.9)\n", "Collecting bcrypt>=3.1.3\n", " Downloading bcrypt-3.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (61 kB)\n", "\u001b[K |████████████████████████████████| 61 kB 386 kB/s \n", "\u001b[?25hCollecting cryptography>=2.5\n", " Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB)\n", "\u001b[K |████████████████████████████████| 3.6 MB 40.6 MB/s \n", "\u001b[?25hCollecting pynacl>=1.0.1\n", " Downloading PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB)\n", "\u001b[K |████████████████████████████████| 961 kB 49.8 MB/s \n", "\u001b[?25hRequirement already satisfied: python-utils>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from progressbar2->pydload==1.0.9->vakyansh-tts==0.0.1) (2.5.6)\n", "Building wheels for collected packages: layers, bashutils, ffmpy, flask-cachebuster\n", " Building wheel for layers (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for layers: filename=layers-0.1.5-py3-none-any.whl size=5379 sha256=759f381849c193619d4e1d46982ad55fd081f3359d2b70d3fede9092d81d6b24\n", " Stored in directory: /root/.cache/pip/wheels/75/6f/32/757f357608178c55254f10906905e7f8cd63b566173377c819\n", " Building wheel for bashutils (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for bashutils: filename=Bashutils-0.0.4-py3-none-any.whl size=5472 sha256=60c44cb259b33784163362297bfeb8a6c349296e3acb89196eb4d9cab2274c08\n", " Stored in directory: /root/.cache/pip/wheels/c7/a0/9a/b99da313eb952e5d8ab2622528c0102544d5cddca1ffc9b15e\n", " Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4710 sha256=a2f3fdb0f222e1f7efb4cec778da16dc98a2dd5504bc1aa55f8d9210904764bf\n", " Stored in directory: /root/.cache/pip/wheels/13/e4/6c/e8059816e86796a597c6e6b0d4c880630f51a1fcfa0befd5e6\n", " Building wheel for flask-cachebuster (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for flask-cachebuster: filename=Flask_CacheBuster-1.0.0-py3-none-any.whl size=3371 sha256=ed02a328b3fdd4faad60c78aff1cdd40efd352cf5bcd5a15e0783d47789aaf19\n", " Stored in directory: /root/.cache/pip/wheels/28/c0/c4/44687421dab41455be93112bd1b0dee1f3c5a9aa27bee63708\n", "Successfully built layers bashutils ffmpy flask-cachebuster\n", "Installing collected packages: sniffio, scipy, pynacl, monotonic, cryptography, bcrypt, backoff, anyio, starlette, pydub, pydantic, pycryptodome, paramiko, matplotlib, markdown2, h11, Flask-Login, Flask-Cors, flask-cachebuster, ffmpy, bashutils, asgiref, analytics-python, wavio, uvicorn, Unidecode, torch, tensorboardX, pydload, layers, inflect, gradio, fastapi, vakyansh-tts\n", " Attempting uninstall: scipy\n", " Found existing installation: scipy 1.4.1\n", " Uninstalling scipy-1.4.1:\n", " Successfully uninstalled scipy-1.4.1\n", " Attempting uninstall: matplotlib\n", " Found existing installation: matplotlib 3.2.2\n", " Uninstalling matplotlib-3.2.2:\n", " Successfully uninstalled matplotlib-3.2.2\n", " Attempting uninstall: torch\n", " Found existing installation: torch 1.10.0+cu111\n", " Uninstalling torch-1.10.0+cu111:\n", " Successfully uninstalled torch-1.10.0+cu111\n", " Attempting uninstall: inflect\n", " Found existing installation: inflect 2.1.0\n", " Uninstalling inflect-2.1.0:\n", " Successfully uninstalled inflect-2.1.0\n", " Running setup.py develop for vakyansh-tts\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "torchvision 0.11.1+cu111 requires torch==1.10.0, but you have torch 1.5.1 which is incompatible.\n", "torchtext 0.11.0 requires torch==1.10.0, but you have torch 1.5.1 which is incompatible.\n", "torchaudio 0.10.0+cu111 requires torch==1.10.0, but you have torch 1.5.1 which is incompatible.\n", "albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.\u001b[0m\n", "Successfully installed Flask-Cors-3.0.10 Flask-Login-0.5.0 Unidecode-1.3.2 analytics-python-1.4.0 anyio-3.4.0 asgiref-3.4.1 backoff-1.10.0 bashutils-0.0.4 bcrypt-3.2.0 cryptography-36.0.1 fastapi-0.70.0 ffmpy-0.3.0 flask-cachebuster-1.0.0 gradio-2.5.2 h11-0.12.0 inflect-5.3.0 layers-0.1.5 markdown2-2.4.2 matplotlib-3.3.4 monotonic-1.6 paramiko-2.9.1 pycryptodome-3.12.0 pydantic-1.9.0 pydload-1.0.9 pydub-0.25.1 pynacl-1.4.0 scipy-1.5.4 sniffio-1.2.0 starlette-0.16.0 tensorboardX-2.4 torch-1.5.1 uvicorn-0.15.0 vakyansh-tts-0.0.1 wavio-0.0.4\n" ] }, { "output_type": "display_data", "data": { "application/vnd.colab-display-data+json": { "pip_warning": { "packages": [ "matplotlib", "mpl_toolkits" ] } } }, "metadata": {} }, { "output_type": "stream", "name": "stdout", "text": [ "--2022-01-04 08:20:03-- https://storage.googleapis.com/vakyaansh-open-models/translit_models/default_lineup.json\n", "Resolving storage.googleapis.com (storage.googleapis.com)... 142.250.141.128, 2607:f8b0:4023:c0b::80\n", "Connecting to storage.googleapis.com (storage.googleapis.com)|142.250.141.128|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 3422 (3.3K) [application/json]\n", "Saving to: ‘default_lineup.json’\n", "\n", "\rdefault_lineup.json 0%[ ] 0 --.-KB/s \rdefault_lineup.json 100%[===================>] 3.34K --.-KB/s in 0s \n", "\n", "2022-01-04 08:20:03 (44.3 MB/s) - ‘default_lineup.json’ saved [3422/3422]\n", "\n", "--2022-01-04 08:20:03-- https://storage.googleapis.com/vakyaansh-open-models/translit_models/hindi/hindi_transliteration.zip\n", "Resolving storage.googleapis.com (storage.googleapis.com)... 142.250.141.128, 2607:f8b0:4023:c0b::80\n", "Connecting to storage.googleapis.com (storage.googleapis.com)|142.250.141.128|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 45018357 (43M) [application/zip]\n", "Saving to: ‘hindi_transliteration.zip’\n", "\n", "hindi_transliterati 100%[===================>] 42.93M 113MB/s in 0.4s \n", "\n", "2022-01-04 08:20:04 (113 MB/s) - ‘hindi_transliteration.zip’ saved [45018357/45018357]\n", "\n", "Archive: hindi_transliteration.zip\n", " inflating: hi_111_model.pth \n", " inflating: hi_scripts.json \n", " inflating: hi_words_a4b.json \n", "--2022-01-04 08:20:05-- https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/glow.zip\n", "Resolving storage.googleapis.com (storage.googleapis.com)... 142.250.141.128, 2607:f8b0:4023:c0b::80\n", "Connecting to storage.googleapis.com (storage.googleapis.com)|142.250.141.128|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 313981548 (299M) [application/zip]\n", "Saving to: ‘glow.zip’\n", "\n", "glow.zip 100%[===================>] 299.44M 109MB/s in 2.7s \n", "\n", "2022-01-04 08:20:08 (109 MB/s) - ‘glow.zip’ saved [313981548/313981548]\n", "\n", "Archive: glow.zip\n", " creating: glow_ckp/\n", " inflating: glow_ckp/config.json \n", " inflating: glow_ckp/G_250.pth \n", "--2022-01-04 08:20:12-- https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/hifi.zip\n", "Resolving storage.googleapis.com (storage.googleapis.com)... 142.250.141.128, 2607:f8b0:4023:c0b::80\n", "Connecting to storage.googleapis.com (storage.googleapis.com)|142.250.141.128|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 51788492 (49M) [application/zip]\n", "Saving to: ‘hifi.zip’\n", "\n", "hifi.zip 100%[===================>] 49.39M 88.9MB/s in 0.6s \n", "\n", "2022-01-04 08:20:13 (88.9 MB/s) - ‘hifi.zip’ saved [51788492/51788492]\n", "\n", "Archive: hifi.zip\n", " creating: hifi_ckp/\n", " inflating: hifi_ckp/config.json \n", " inflating: hifi_ckp/g_00100000 \n" ] } ], "source": [ "import os\n", "!git clone https://github.com/Open-Speech-EkStep/vakyansh-tts\n", "os.chdir('vakyansh-tts') \n", "!bash install.sh\n", "!python setup.py bdist_wheel\n", "!pip install -e .\n", "os.chdir('tts_infer')\n", "!mkdir translit_models\n", "os.chdir('translit_models')\n", "!wget https://storage.googleapis.com/vakyaansh-open-models/translit_models/default_lineup.json\n", "!mkdir hindi\n", "os.chdir('hindi')\n", "!wget https://storage.googleapis.com/vakyaansh-open-models/translit_models/hindi/hindi_transliteration.zip\n", "!unzip hindi_transliteration\n", "\n", "!wget https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/glow.zip\n", "!unzip glow.zip\n", "\n", "!wget https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/hifi.zip\n", "!unzip hifi.zip\n", "\n", "!rm glow.zip\n", "!rm hifi.zip\n", "\n", "os.chdir('/content/vakyansh-tts/')" ] }, { "cell_type": "markdown", "source": [ "## Inference Code" ], "metadata": { "id": "NvQoCgYzKbWN" } }, { "cell_type": "code", "source": [ "from tts_infer.tts import TextToMel, MelToWav\n", "from tts_infer.transliterate import XlitEngine\n", "from tts_infer.num_to_word_on_sent import normalize_nums\n", "\n", "import re\n", "from scipy.io.wavfile import write\n", "device = 'cpu'\n", "\n", "text_to_mel = TextToMel(glow_model_dir='/content/vakyansh-tts/tts_infer/translit_models/hindi/glow_ckp', device=device)\n", "mel_to_wav = MelToWav(hifi_model_dir='/content/vakyansh-tts/tts_infer/translit_models/hindi/hifi_ckp', device=device)\n", "\n", "def translit(text, lang):\n", " reg = re.compile(r'[a-zA-Z]')\n", " engine = XlitEngine(lang)\n", " words = [engine.translit_word(word, topk=1)[lang][0] if reg.match(word) else word for word in text.split()]\n", " updated_sent = ' '.join(words)\n", " return updated_sent\n", " \n", "def run_tts(text, lang):\n", " text = text.replace('।', '.') # only for hindi models\n", " text_num_to_word = normalize_nums(text, lang) # converting numbers to words in lang\n", " text_num_to_word_and_transliterated = translit(text_num_to_word, lang) # transliterating english words to lang\n", " \n", " mel = text_to_mel.generate_mel(text_num_to_word_and_transliterated)\n", " audio, sr = mel_to_wav.generate_wav(mel)\n", " write(filename='temp.wav', rate=sr, data=audio) # for saving wav file, if needed\n", " return (sr, audio)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "TVW_x9L0b5W4", "outputId": "28f0a3b9-8f72-4562-db4b-af49699d6cc3" }, "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/vakyansh-tts/tts_infer/translit_models/hindi/glow_ckp/G_250.pth\n", "INFO:root:Loaded checkpoint '/content/vakyansh-tts/tts_infer/translit_models/hindi/glow_ckp/G_250.pth' (iteration 250)\n", "/content/vakyansh-tts/tts_infer/translit_models/hindi/hifi_ckp/g_00100000\n", "Loading '/content/vakyansh-tts/tts_infer/translit_models/hindi/hifi_ckp/g_00100000'\n", "Complete.\n", "Removing weight norm...\n" ] } ] }, { "cell_type": "code", "source": [ "_, audio = run_tts('hello my name is harveen', 'hi')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "aqZ5xOVidczp", "outputId": "bdf8f92b-c673-4738-860e-0cbf3f339d6e" }, "execution_count": 3, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Loading hi...\n" ] } ] }, { "cell_type": "markdown", "source": [ "## Results" ], "metadata": { "id": "jaFjD59HKghg" } }, { "cell_type": "code", "source": [ "import IPython.display as ipd\n", "ipd.Audio('temp.wav')" ], "metadata": { "id": "zC9I2Zt5fijp", "colab": { "base_uri": "https://localhost:8080/", "height": 75 }, "outputId": "86d09807-41a8-48e7-ec71-4734b6ccbdc8" }, "execution_count": 4, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 4 } ] } ] }