Skip to content

Commit

Permalink
Don't forget to mount mean character embeddings and add security impr…
Browse files Browse the repository at this point in the history
…ovements
  • Loading branch information
Darwinkel committed Feb 26, 2024
1 parent 7c6bf85 commit d7235d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions code/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
# Load speaker embeddings and gpt cond latents into memory for performance (~100mb)
CHARACTER_SPEAKER_EMBEDDINGS = {}
CHARACTER_GPT_COND_LATENTS = {}
for file in Path("mean_character_embeddings").glob("*_speaker_embedding.pt"):
for file in Path(settings.MEAN_CHARACTER_EMBEDDINGS_PATH).glob("*_speaker_embedding.pt"):
character = file.stem[:-18]

CHARACTER_SPEAKER_EMBEDDINGS[character] = torch.load(
f"mean_character_embeddings/{character}_speaker_embedding.pt",
f"{settings.MEAN_CHARACTER_EMBEDDINGS_PATH}/{character}_speaker_embedding.pt",
map_location=torch.device(settings.DEVICE),
)
CHARACTER_GPT_COND_LATENTS[character] = torch.load(
f"mean_character_embeddings/{character}_gpt_cond_latent.pt",
f"{settings.MEAN_CHARACTER_EMBEDDINGS_PATH}/{character}_gpt_cond_latent.pt",
map_location=torch.device(settings.DEVICE),
)
print(file)

Check failure on line 32 in code/app.py

View workflow job for this annotation

GitHub Actions / ruff-check

Ruff (T201)

code/app.py:32:5: T201 `print` found
Expand Down
4 changes: 3 additions & 1 deletion code/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

import torch

DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

CHECKPOINT_DIR = "/xtts_model"
CHECKPOINTS_CONFIG_JSON = "/xtts_model/config.json"
CHECKPOINT_VOCAB_JSON = "/xtts_model/vocab.json"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
MEAN_CHARACTER_EMBEDDINGS_PATH = "/mean_character_embeddings"

GRADIO_EXAMPLES_CACHE = os.environ["GRADIO_EXAMPLES_CACHE"]
SECRET_KEY = os.environ["SECRET_KEY"]
7 changes: 6 additions & 1 deletion docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ services:
- "1337:1337"
volumes:
- ./current_model/:/xtts_model/:ro
- ./mean_character_embeddings/:/mean_character_embeddings/:ro
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
environment:
GRADIO_EXAMPLES_CACHE: "/tmp/"
GRADIO_ANALYTICS_ENABLED: False
GRADIO_SERVER_NAME: "0.0.0.0"
GRADIO_SERVER_PORT: 1337
SECRET_KEY: "changeme"
SECRET_KEY: "changeme"

0 comments on commit d7235d1

Please sign in to comment.