<jupyter_start><jupyter_text>Minimal DemoThis is a minimal demo of Representation Mixing, for more details see the [arxiv paper](https://arxiv.org/abs/1811.07240)Approximate runtime ~4 minutes  Setup Install dependencies<jupyter_code>import os
from os.path import exists, join, expanduser

os.chdir(os.path.expanduser("~"))

representation_mixing_dir = "representation_mixing"
if not os.path.exists(representation_mixing_dir):
  ! git clone https://github.com/kastnerkyle/$representation_mixing_dir

# Install dependencies
! pip install -q --upgrade "tensorflow<=1.6.0"
! pip install -q --upgrade "unidecode"
os.chdir(representation_mixing_dir)
os.chdir("pretrained")<jupyter_output><empty_output><jupyter_text>Input texts to be synthesizedChoose your favorite sentences :)<jupyter_code>if os.path.exists("sample_lines.txt"):
      os.remove("sample_lines.txt")
%%bash
cat << EOS > sample_lines.txt
The cat ate bread.
That cat is not dead.
EOS

cat sample_lines.txt
! bash sample.sh
import IPython
from IPython.display import Audio
import numpy as np<jupyter_output><empty_output><jupyter_text>Summary: audio samples<jupyter_code>with open("sample_lines.txt", "r") as f:
    lines = f.readlines()
lines = [l.strip() for l in lines]

def sort(files):
    return sorted(files, key=lambda k: int(k.split("_")[1]))
    
mel_files = sort([f for f in os.listdir(".") if "_mels.npz" in f])
audio_files = sort([f for f in os.listdir(".") if "_post.wav" in f])          
maps = zip(lines, mel_files[:len(lines)], audio_files[:len(lines)])

for idx, (text, mel, audio) in enumerate(maps):
  print(idx, text)
  IPython.display.display(Audio(audio, rate=22050))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13103037522334723, 'fraction_numerical': 0.011316259678379988, 'mean_word_length': 5.693227091633466, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '138578', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 602, 'n_tokens_neox': 574, 'n_words': 146, 'path': 'pretrained/representation_mixing_text_to_speech_demo_minimal.ipynb', 'repo_name': 'ishandutta2007/representation_mixing', 'size': '1679'}