Logo Lanfrica

Rono8/Kiswahili_TTS_Synthesis_Code

Domaine:

natural language processing

Type de record:

software
Créateur:
Ron
Hôte:
# Kiswahili_TTS_Synthesis_Code The synthesis code for the Kiswahili TTS is ``` import os import sys ! git clone Rono8/kiswahili_tts os.chdir("./kiswahili_tts") !pip install . !pip install git+github.com #egg=german_transliterate !pip uninstall tensorflow -y !pip install tensorflow==2.3 import itertools import logging import os import random import argparse import logging import numpy as np import yaml from tqdm import tqdm import tensorflow as tf from tensorflow_tts.inference import TFAutoModel from tensorflow_tts.inference import AutoConfig from tensorflow_tts.inference import AutoProcessor import IPython.display as ipd import matplotlib.pyplot as plt physical_devices = tf.config.list_physical_devices("GPU") for i in range(len(physical_devices)): tf.config.experimental.set_memory_growth(physical_devices[i], True) # Download pretrained model zip file from drive print("Downloading zip model...") !gdown --id {"1j7IHz_2m60vVhxgp9VK3EXd2JlKz2xk3"} -O model-150000.h5 #!gdown --id {"1-1cpmelBQG2VaptQk8bFYmrUyhMYyivL"} -O tacotron2.v1.yaml # Download pretrained Vocoder model print("Downloading MelGAN model...") !gdown --id {"1A3zJwzlXEpu_jHeatlMdyPGjn1V7-9iG"} -O melgan-1M6.h5 !gdown --id {"1Ys-twSd3m2uqhJOEiobNox6RNQf4txZs"} -O melgan_config.yml # Load Vocoder melgan_config = AutoConfig.from_pretrained('/content/kiswahili_tts/examples/melgan/conf/melgan.v1.yaml') melgan = TFAutoModel.from_pretrained( config=melgan_config, pretrained_path="melgan-1M6.h5", name="melgan" ) # Load Model tacotron2_config = AutoConfig.from_pretrained('/content/kiswahili_tts/examples/tacotron2/conf/tacotron2.v1.yaml') tacotron2 = TFAutoModel.from_pretrained( config=tacotron2_config, pretrained_path="/content/kiswahili_tts/model-150000.h5", name="tacotron2" ) #processor = AutoProcessor.from_pretrained(pretrained_path="/content/drive/MyDrive/ljspeech_mapper.json") processor = AutoProcessor.from_pretrained(pretrained_path="/cont …