mozilla-foundation/common_voice_13_0
Updated • 1.7k • 5
How to use ImhotepAI/yoruba-tts with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-to-speech", model="ImhotepAI/yoruba-tts") # Load model directly
from transformers import AutoProcessor, AutoModelForTextToSpectrogram
processor = AutoProcessor.from_pretrained("ImhotepAI/yoruba-tts")
model = AutoModelForTextToSpectrogram.from_pretrained("ImhotepAI/yoruba-tts")# Load model directly
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
from huggingface_hub import hf_hub_download
import torch
processor = SpeechT5Processor.from_pretrained("imhotepai/yoruba-tts")
model = SpeechT5ForTextToSpeech.from_pretrained("imhotepai/yoruba-tts")
dir_= hf_hub_download(repo_id="imhotepai/yoruba-tts", filename="speaker_embeddings.pt")
speaker_embeddings= torch.load(dir_)
text='Báwó ni'.lower()
inputs = processor(text=text, return_tensors="pt")
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
# Audio in notebook
from IPython.display import Audio
Audio(speech.numpy(), rate=16000)