league of legends jhin en tts fine tuned with xtts-webui from https://github.com/daswer123/xtts-webui
example of using the model locally in python:
import os import torch from TTS.tts.configs.xtts_config import XttsConfig from TTS.tts.models.xtts import Xtts
#In this example all the model files are saved in a folder name "optimized_model"
#Load the model config
config = XttsConfig() config.load_json(os.path.join(os.path.dirname(file), "optimized_model/config.json")) print("config path: ", os.path.join(os.path.dirname(file), "optimized_model/config.json"))
#Initialize the model
model = Xtts.init_from_config(config)
#Load the model weights
model.load_checkpoint(config, checkpoint_dir=os.path.join(os.path.dirname(file), "optimized_model/"),eval=True) print("model path: ", os.path.join(os.path.dirname(file), "optimized_model/"))
#Move model to GPU if available
if torch.cuda.is_available(): print("cuda is available") device = "cuda" else: print("cpu is available") device = "cpu"
model.to(device)
#Generate speech
text = "I cannot be good. I must be perfection." speaker_wav = os.path.join(os.path.dirname(file), "optimized_model/reference.wav") # Update this to your reference audio path print("speaker_wav path: ", os.path.join(os.path.dirname(file), "optimized_model/reference.wav")) outputs = model.synthesize( text, config=config, speaker_wav=speaker_wav, gpt_cond_len=3, language="en", )
import sounddevice as sd
#Get the audio data and sample rate from outputs
audio = outputs["wav"] sample_rate = config.audio.sample_rate
#Lower the volume by reducing amplitude
audio = audio * 0.5 # Reduce volume by 50%
#Save as WAV file
import soundfile as sf sf.write('output.wav', audio, sample_rate)
#Play the audio at lower volume
sd.play(audio, sample_rate) sd.wait() # Wait until the audio finishes playing
- Downloads last month
- 102
Model tree for twph/jhin_xtts
Base model
coqui/XTTS-v2