Skip to content

Commit

Permalink
Update to latest TTS
Browse files Browse the repository at this point in the history
  • Loading branch information
WeberJulian committed Dec 12, 2023
1 parent 24b0f6d commit c282c36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
model_path = os.path.join(get_user_data_dir("tts"), model_name.replace("/", "--"))
print("XTTS Model downloaded", flush=True)

# Temporary fix, to wait for the TTS update
import requests
speakers = requests.get("https://huggingface.co/coqui/XTTS-v2/resolve/main/speakers.pth")
with open(os.path.join(model_path, "speakers.pth"), "wb") as fp:
fp.write(speakers.content)

print("Loading XTTS", flush=True)
config = XttsConfig()
config.load_json(os.path.join(model_path, "config.json"))
Expand Down Expand Up @@ -185,15 +179,13 @@ def predict_speech(parsed_input: TTSInputs):

@app.get("/studio_speakers")
def get_speakers():
speaker_file = os.path.join(model_path, "speakers.pth")
if os.path.isfile(speaker_file):
speakers = torch.load(speaker_file)
if hasattr(model, "speaker_manager") and hasattr(model.speaker_manager, "speakers"):
return {
speaker: {
"speaker_embedding": speakers[speaker]["speaker_embedding"].cpu().squeeze().half().tolist(),
"gpt_cond_latent": speakers[speaker]["gpt_cond_latent"].cpu().squeeze().half().tolist(),
"speaker_embedding": model.speaker_manager.speakers[speaker]["speaker_embedding"].cpu().squeeze().half().tolist(),
"gpt_cond_latent": model.speaker_manager.speakers[speaker]["gpt_cond_latent"].cpu().squeeze().half().tolist(),
}
for speaker in speakers.keys()
for speaker in model.speaker_manager.speakers.keys()
}
else:
return {}
Expand Down
2 changes: 1 addition & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TTS @ git+https://github.com/coqui-ai/TTS@00a870c26abdc06429ffef3e2814b1a1d5b40fff
TTS @ git+https://github.com/coqui-ai/TTS@fa28f99f1508b5b5366539b2149963edcb80ba62
uvicorn[standard]==0.23.2
fastapi==0.95.2
deepspeed==0.10.3
Expand Down

0 comments on commit c282c36

Please sign in to comment.