TTS/notebooks/Benchmark.ipynb

542 lines
17 KiB
Plaintext
Raw Normal View History

2018-05-25 11:28:24 +00:00
{
"cells": [
{
2018-09-27 13:35:06 +00:00
"cell_type": "markdown",
2018-05-25 11:28:24 +00:00
"metadata": {},
2018-09-27 13:35:06 +00:00
"source": [
2019-04-12 14:14:10 +00:00
"This is to test TTS models with benchmark sentences for speech synthesis.\n",
"\n",
"Before running this script please DON'T FORGET: \n",
"- to set file paths.\n",
"- to download related model files from TTS and WaveRNN.\n",
"- to checkout right commit versions (given next to the model) of TTS and WaveRNN.\n",
"- to set the right paths in the cell below.\n",
"\n",
"Repositories:\n",
"- TTS: https://github.com/mozilla/TTS\n",
"- WaveRNN: https://github.com/erogol/WaveRNN"
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
2019-04-12 14:14:10 +00:00
"outputs": [],
"source": [
"TTS_PATH = \"/home/erogol/projects/\"\n",
"WAVERNN_PATH =\"/home/erogol/projects/\""
2018-09-27 13:35:06 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2018-09-27 13:35:06 +00:00
"metadata": {
"scrolled": true
},
2019-09-24 14:58:52 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"import os\n",
"import sys\n",
"import io\n",
"import torch \n",
"import time\n",
2019-09-24 14:58:52 +00:00
"import json\n",
2018-05-25 11:28:24 +00:00
"import numpy as np\n",
"from collections import OrderedDict\n",
"from matplotlib import pylab as plt\n",
"\n",
"%pylab inline\n",
"rcParams[\"figure.figsize\"] = (16,5)\n",
2019-04-12 14:14:10 +00:00
"\n",
"# add libraries into environment\n",
"sys.path.append(TTS_PATH) # set this if TTS is not installed globally\n",
"sys.path.append(WAVERNN_PATH) # set this if TTS is not installed globally\n",
2018-05-25 11:28:24 +00:00
"\n",
"import librosa\n",
"import librosa.display\n",
"\n",
"from TTS.models.tacotron import Tacotron \n",
"from TTS.layers import *\n",
"from TTS.utils.data import *\n",
"from TTS.utils.audio import AudioProcessor\n",
"from TTS.utils.generic_utils import load_config, setup_model\n",
2018-05-25 11:28:24 +00:00
"from TTS.utils.text import text_to_sequence\n",
2019-02-18 12:07:28 +00:00
"from TTS.utils.synthesis import synthesis\n",
"from TTS.utils.visual import visualize\n",
2018-05-25 11:28:24 +00:00
"\n",
"import IPython\n",
2019-05-28 12:50:40 +00:00
"from IPython.display import Audio\n",
"\n",
"import os\n",
2019-09-24 14:58:52 +00:00
"os.environ['CUDA_VISIBLE_DEVICES']='1'"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
2018-05-25 11:28:24 +00:00
"outputs": [],
"source": [
2019-09-24 14:58:52 +00:00
"def tts(model, text, CONFIG, use_cuda, ap, use_gl, figures=True):\n",
2018-05-25 11:28:24 +00:00
" t_1 = time.time()\n",
2019-09-24 14:58:52 +00:00
" waveform, alignment, mel_spec, mel_postnet_spec, stop_tokens = synthesis(model, text, CONFIG, use_cuda, ap, speaker_id, False, CONFIG.enable_eos_bos_chars)\n",
2019-05-28 12:50:40 +00:00
" if CONFIG.model == \"Tacotron\" and not use_gl:\n",
2019-09-24 14:58:52 +00:00
" # coorect the normalization differences b/w TTS and the Vocoder.\n",
2019-05-28 12:50:40 +00:00
" mel_postnet_spec = ap.out_linear_to_mel(mel_postnet_spec.T).T\n",
2019-09-24 14:58:52 +00:00
" mel_postnet_spec = ap._denormalize(mel_postnet_spec)\n",
" mel_postnet_spec = ap_vocoder._normalize(mel_postnet_spec)\n",
" if not use_gl:\n",
2019-09-24 14:58:52 +00:00
" waveform = wavernn.generate(torch.FloatTensor(mel_postnet_spec.T).unsqueeze(0).cuda(), batched=batched_wavernn, target=8000, overlap=400)\n",
"\n",
2018-05-25 11:28:24 +00:00
" print(\" > Run-time: {}\".format(time.time() - t_1))\n",
" if figures: \n",
" visualize(alignment, mel_postnet_spec, stop_tokens, text, ap.hop_length, CONFIG, mel_spec) \n",
2019-02-18 12:07:28 +00:00
" IPython.display.display(Audio(waveform, rate=CONFIG.audio['sample_rate'])) \n",
" os.makedirs(OUT_FOLDER, exist_ok=True)\n",
2018-05-25 11:30:00 +00:00
" file_name = text.replace(\" \", \"_\").replace(\".\",\"\") + \".wav\"\n",
" out_path = os.path.join(OUT_FOLDER, file_name)\n",
2018-05-25 11:30:00 +00:00
" ap.save_wav(waveform, out_path)\n",
" return alignment, mel_postnet_spec, stop_tokens, waveform"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
2019-09-24 14:58:52 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
"# Set constants\n",
2019-09-24 14:58:52 +00:00
"ROOT_PATH = '/media/erogol/data_ssd/Models/libri_tts/5099/'\n",
"MODEL_PATH = ROOT_PATH + '/best_model.pth.tar'\n",
2018-05-25 11:28:24 +00:00
"CONFIG_PATH = ROOT_PATH + '/config.json'\n",
2019-09-24 14:58:52 +00:00
"OUT_FOLDER = '/home/erogol/Dropbox/AudioSamples/benchmark_samples/'\n",
2018-05-25 11:28:24 +00:00
"CONFIG = load_config(CONFIG_PATH)\n",
2019-09-24 14:58:52 +00:00
"VOCODER_MODEL_PATH = \"/media/erogol/data_ssd/Models/wavernn/ljspeech/mold_ljspeech_best_model/checkpoint_433000.pth.tar\"\n",
"VOCODER_CONFIG_PATH = \"/media/erogol/data_ssd/Models/wavernn/ljspeech/mold_ljspeech_best_model/config.json\"\n",
"VOCODER_CONFIG = load_config(VOCODER_CONFIG_PATH)\n",
2019-05-28 12:50:40 +00:00
"use_cuda = False\n",
2019-05-28 12:53:47 +00:00
"\n",
"# Set some config fields manually for testing\n",
2019-06-03 09:25:43 +00:00
"# CONFIG.windowing = False\n",
"# CONFIG.prenet_dropout = False\n",
"# CONFIG.separate_stopnet = True\n",
2019-09-24 14:58:52 +00:00
"CONFIG.use_forward_attn = True\n",
"# CONFIG.forward_attn_mask = True\n",
2019-06-03 09:25:43 +00:00
"# CONFIG.stopnet = True\n",
2019-05-28 12:53:47 +00:00
"\n",
"# Set the vocoder\n",
2019-09-24 14:58:52 +00:00
"use_gl = False # use GL if True\n",
2019-04-12 14:14:10 +00:00
"batched_wavernn = True # use batched wavernn inference if True"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
"# LOAD TTS MODEL\n",
2019-09-05 10:54:45 +00:00
"from utils.text.symbols import symbols, phonemes\n",
2019-08-23 11:07:58 +00:00
"\n",
2019-09-24 14:58:52 +00:00
"# multi speaker \n",
"if CONFIG.use_speaker_embedding:\n",
" speakers = json.load(open(f\"{ROOT_PATH}/speakers.json\", 'r'))\n",
" speakers_idx_to_id = {v: k for k, v in speakers.items()}\n",
"else:\n",
" speakers = []\n",
" speaker_id = None\n",
"\n",
2018-05-25 11:28:24 +00:00
"# load the model\n",
2019-02-18 12:07:28 +00:00
"num_chars = len(phonemes) if CONFIG.use_phonemes else len(symbols)\n",
2019-09-24 14:58:52 +00:00
"model = setup_model(num_chars, len(speakers), CONFIG)\n",
2018-05-25 11:28:24 +00:00
"\n",
"# load the audio processor\n",
2019-02-18 12:07:28 +00:00
"ap = AudioProcessor(**CONFIG.audio) \n",
2018-05-25 11:28:24 +00:00
"\n",
"\n",
"# load model state\n",
"if use_cuda:\n",
" cp = torch.load(MODEL_PATH)\n",
"else:\n",
" cp = torch.load(MODEL_PATH, map_location=lambda storage, loc: storage)\n",
"\n",
"# load the model\n",
"model.load_state_dict(cp['model'])\n",
"if use_cuda:\n",
" model.cuda()\n",
2019-02-18 12:07:28 +00:00
"model.eval()\n",
2019-09-24 14:58:52 +00:00
"print(cp['step'])\n",
"print(cp['r'])\n",
"\n",
"# set model stepsize\n",
"if 'r' in cp:\n",
" model.decoder.set_r(cp['r'])"
]
},
{
"cell_type": "code",
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
"outputs": [],
"source": [
"# LOAD WAVERNN\n",
"if use_gl == False:\n",
" from WaveRNN.models.wavernn import Model\n",
2019-09-24 14:58:52 +00:00
" from WaveRNN.utils.audio import AudioProcessor as AudioProcessorVocoder\n",
" bits = 10\n",
2019-09-24 14:58:52 +00:00
" ap_vocoder = AudioProcessorVocoder(**VOCODER_CONFIG.audio) \n",
" wavernn = Model(\n",
" rnn_dims=512,\n",
" fc_dims=512,\n",
2019-09-24 14:58:52 +00:00
" mode=VOCODER_CONFIG.mode,\n",
" mulaw=VOCODER_CONFIG.mulaw,\n",
" pad=VOCODER_CONFIG.pad,\n",
" upsample_factors=VOCODER_CONFIG.upsample_factors,\n",
" feat_dims=VOCODER_CONFIG.audio[\"num_mels\"],\n",
" compute_dims=128,\n",
" res_out_dims=128,\n",
" res_blocks=10,\n",
2019-09-24 14:58:52 +00:00
" hop_length=ap_vocoder.hop_length,\n",
" sample_rate=ap_vocoder.sample_rate,\n",
" use_upsample_net = True,\n",
" use_aux_net = True\n",
" ).cuda()\n",
"\n",
" check = torch.load(VOCODER_MODEL_PATH)\n",
2019-09-24 14:58:52 +00:00
" wavernn.load_state_dict(check['model'], strict=False)\n",
" if use_cuda:\n",
" wavernn.cuda()\n",
2019-05-28 12:50:40 +00:00
" wavernn.eval();\n",
" print(check['step'])"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Comparision with https://mycroft.ai/blog/available-voices/"
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
2019-09-24 14:58:52 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
2019-02-18 12:07:28 +00:00
"model.eval()\n",
"model.decoder.max_decoder_steps = 2000\n",
2019-09-24 14:58:52 +00:00
"speaker_id = None\n",
"sentence = \"Bill got in the habit of asking himself “Is that thought true?” and if he wasnt absolutely certain it was, he just let it go.\"\n",
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.eval()\n",
"model.decoder.max_decoder_steps = 2000\n",
"sentence = \"Bill got in the habit of asking himself “Is that thought true?” and if he wasnt absolutely certain it was, he just let it go.\"\n",
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2019-09-05 10:54:45 +00:00
"source": [
"sentence = \"Be a voice, not an echo.\" # 'echo' is not in training set. \n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-09-05 10:54:45 +00:00
"metadata": {},
2019-09-24 14:58:52 +00:00
"outputs": [],
2019-09-05 10:54:45 +00:00
"source": [
"sentence = \"The human voice is the most perfect instrument of all.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
2019-09-24 14:58:52 +00:00
"execution_count": null,
2019-09-05 10:54:45 +00:00
"metadata": {},
2019-09-24 14:58:52 +00:00
"outputs": [],
2019-09-05 10:54:45 +00:00
"source": [
"sentence = \"I'm sorry Dave. I'm afraid I can't do that.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"This cake is great. It's so delicious and moist.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Comparison with https://keithito.github.io/audio-samples/"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2019-02-18 12:07:28 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Generative adversarial network or variational auto-encoder.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Scientists at the CERN laboratory say they have discovered a new particle.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Heres a way to measure the acute emotional intelligence that has never gone out of style.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:28:24 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:28:24 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"President Trump met with other leaders at the Group of 20 conference.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"The buses aren't the problem, they actually provide a solution.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:28:24 +00:00
]
2018-05-25 11:30:00 +00:00
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2019-09-05 10:54:45 +00:00
"### Comparison with https://google.github.io/tacotron/publications/tacotron/index.html"
2018-05-25 11:30:00 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:30:00 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Generative adversarial network or variational auto-encoder.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:30:00 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:30:00 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Basilar membrane and otolaryngology are not auto-correlations.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:30:00 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:30:00 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \" He has read the whole thing.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:30:00 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-05-25 11:30:00 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"He reads books.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"Thisss isrealy awhsome.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"This is your internet browser, Firefox.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"This is your internet browser Firefox.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"The quick brown fox jumps over the lazy dog.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"Does the quick brown fox jump over the lazy dog?\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:30:00 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-08-23 11:07:58 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-09-27 13:35:06 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Eren, how are you?\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-09-27 13:35:06 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2019-09-05 10:54:45 +00:00
"### Hard Sentences"
2019-02-18 12:07:28 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-09-27 13:35:06 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"Encouraged, he started with a minute a day.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-09-27 13:35:06 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-05-28 12:53:47 +00:00
"outputs": [],
2018-09-27 13:35:06 +00:00
"source": [
2019-09-05 10:54:45 +00:00
"sentence = \"His meditation consisted of “body scanning” which involved focusing his mind and energy on each section of the body from head to toe .\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-09-27 13:35:06 +00:00
]
},
{
"cell_type": "code",
2019-05-28 12:53:47 +00:00
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"Recent research at Harvard has shown meditating for as little as 8 weeks can actually increase the grey matter in the parts of the brain responsible for emotional regulation and learning . \"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"If he decided to watch TV he really watched it.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"sentence = \"Often we try to bring about change through sheer effort and we put all of our energy into a new initiative .\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2019-09-05 10:54:45 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
2019-09-24 14:58:52 +00:00
"metadata": {},
2019-09-05 10:54:45 +00:00
"outputs": [],
"source": [
"# for twb dataset\n",
"sentence = \"In our preparation for Easter, God in his providence offers us each year the season of Lent as a sacramental sign of our conversion.\"\n",
2019-09-24 14:58:52 +00:00
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
2018-05-25 11:30:00 +00:00
]
2018-05-25 11:28:24 +00:00
}
],
"metadata": {
"kernelspec": {
2019-08-23 11:07:58 +00:00
"display_name": "Python 3",
2018-05-25 11:28:24 +00:00
"language": "python",
2019-08-23 11:07:58 +00:00
"name": "python3"
2018-05-25 11:28:24 +00:00
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2019-08-23 11:07:58 +00:00
"version": "3.7.3"
2018-05-25 11:28:24 +00:00
}
},
"nbformat": 4,
2019-08-23 11:07:58 +00:00
"nbformat_minor": 4
2018-05-25 11:28:24 +00:00
}