<jupyter_start><jupyter_text>Setup<jupyter_code># Clone the repo including pretrained models
!git clone https://github.com/as-ideas/ForwardTacotron.git
# Install requirements
%cd ForwardTacotron/  
!apt-get install espeak
!pip install -r requirements.txt
# Load pretrained models
from notebook_utils.synthesize import (
    get_forward_model, get_melgan_model, get_wavernn_model, synthesize, init_hparams)
from utils import hparams as hp
import IPython.display as ipd
init_hparams('notebook_utils/pretrained_hparams.py')
tts_model = get_forward_model('pretrained/forward_400K.pyt')
voc_melgan = get_melgan_model() 
voc_wavernn = get_wavernn_model('pretrained/wave_575K.pyt')<jupyter_output>Downloading: "https://github.com/seungwonpark/melgan/archive/master.zip" to /root/.cache/torch/hub/master.zip
Downloading: "https://github.com/seungwonpark/melgan/releases/download/v0.3-alpha/nvidia_tacotron2_LJ11_epoch6400.pt" to /root/.cache/torch/hub/checkpoints/nvidia_tacotron2_LJ11_epoch6400.pt<jupyter_text>Synthesize<jupyter_code># Synthesize with melgan (alpha=1.0)
input_text = 'In the middle of difficulty lies opportunity.'
wav = synthesize(input_text, tts_model, voc_melgan, alpha=1)
ipd.Audio(wav, rate=hp.sample_rate)

# Synthesize with wavernn (alpha=1.0)
input_text = 'In the middle of difficulty lies opportunity.'
wav = synthesize(input_text, tts_model, voc_wavernn, alpha=1)
ipd.Audio(wav, rate=hp.sample_rate)

# Synthesize with faster speed (alpha=1.2)
input_text = 'In the middle of difficulty lies opportunity.'
wav = synthesize(input_text, tts_model, voc_melgan, alpha=1.2)
ipd.Audio(wav, rate=hp.sample_rate)
# Synthesize with slower speed (alpha=0.8)
input_text = 'In the middle of difficulty lies opportunity.'
wav = synthesize(input_text, tts_model, voc_melgan, alpha=0.8)
ipd.Audio(wav, rate=hp.sample_rate)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10716208939149165, 'fraction_numerical': 0.01938610662358643, 'mean_word_length': 7.008620689655173, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '94633', 'license': 'MIT', 'n_tokens_mistral': 713, 'n_tokens_neox': 682, 'n_words': 134, 'path': 'notebooks/synthesize.ipynb', 'repo_name': 'prajwaljpj/ForwardTacotron', 'size': '1857'}