First of all thanks a lot! Finally managed to install successfully, run and generate speech
my current code is:
from MeloTTS.melo.api import TTS
from pydub import AudioSegment
from pydub.playback import play
# Speed is adjustable
speed = 1.0
# CPU is sufficient for real-time inference.
# You can set it manually to 'cpu' or 'cuda' or 'cuda:0' or 'mps'
device = 'auto' # Will automatically use GPU if available
# English
text = "Did you ever hear a folk tale about a giant turtle?"
model = TTS(language='EN', device=device)
speaker_ids = model.hps.data.spk2id
output_path = 'en-default.wav'
while True:
print("Enter message:")
text = input()
model.tts_to_file(text, speaker_ids['EN-Default'], output_path, speed=speed)
print("________")
sound = AudioSegment.from_wav(output_path)
play(sound)
the thing is.. sometimes the generation is INSTANT but MOST times, theres a short lag...
I've noticed that this lag happens for both one-word-generations
and long-text-generationsthey seem to take around the same time!
Hence! A cold start!
meaning that something is loaded over and over in the code...
and perhaps theres away to keep it loaded, for example setting a local/global variable to save most of the things loaded
and try to redo as less as possible when getting a new text to generate
My assumption is that somewhere in this code, you could skip a few fetches that were already been done before:
like maybe you can skip [torch.cuda.empty_cache() or torch.LongTensor([phones.size(0)]).to(device) or something ] somehow.
maybe one of those vars are the same, or theres a way to make part of them beforehand, or reuse previously, etc
I wouldnt complain, but i have a feeling you can get this to generate much faster
please let me know if you get what i'm suggesting, and or if theres a better/recommended way to generate faster
and avoid the noticeable coldstart of generations
Hi there :)
First of all thanks a lot! Finally managed to install successfully, run and generate speech
my current code is:
the thing is.. sometimes the generation is INSTANT but MOST times, theres a short lag... I've noticed that this lag happens for both
one-word-generations
andlong-text-generations
they seem to take around the same time! Hence! A cold start!My assumption is that somewhere in this code, you could skip a few fetches that were already been done before:
{my thoughts}:
I wouldnt complain, but i have a feeling you can get this to generate much faster please let me know if you get what i'm suggesting, and or if theres a better/recommended way to generate faster and avoid the noticeable coldstart of generations
Thanks a lot and all the best!