Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,10 +22,34 @@ SPEAKER2REFS_PATH = os.path.join(DATA_ROOT, "speaker2refs.json")
|
|
| 22 |
CKPT_REPO = "stephenhoang/ttsStyleTTS2-ms152"
|
| 23 |
models_path = hf_hub_download(repo_id=CKPT_REPO, filename="epoch_00000.pth")
|
| 24 |
config_path = hf_hub_download(repo_id=CKPT_REPO, filename="config.yaml")
|
|
|
|
| 25 |
|
| 26 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 27 |
|
| 28 |
# =========================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# LOAD speaker2refs.json
|
| 30 |
# =========================
|
| 31 |
if not os.path.isfile(SPEAKER2REFS_PATH):
|
|
|
|
| 22 |
CKPT_REPO = "stephenhoang/ttsStyleTTS2-ms152"
|
| 23 |
models_path = hf_hub_download(repo_id=CKPT_REPO, filename="epoch_00000.pth")
|
| 24 |
config_path = hf_hub_download(repo_id=CKPT_REPO, filename="config.yaml")
|
| 25 |
+
cfg = yaml.safe_load(open(config_path, "r", encoding="utf-8"))
|
| 26 |
|
| 27 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 28 |
|
| 29 |
# =========================
|
| 30 |
+
|
| 31 |
+
# ================= DEBUG SYMBOLS =================
|
| 32 |
+
try:
|
| 33 |
+
symbols = (
|
| 34 |
+
list(cfg['symbol']['pad']) +
|
| 35 |
+
list(cfg['symbol']['punctuation']) +
|
| 36 |
+
list(cfg['symbol']['letters']) +
|
| 37 |
+
list(cfg['symbol']['letters_ipa']) +
|
| 38 |
+
list(cfg['symbol']['extend'])
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
print("\n========== SYMBOL DEBUG ==========")
|
| 42 |
+
print("Total symbols (+pad):", len(symbols) + 1)
|
| 43 |
+
|
| 44 |
+
for i in range(min(30, len(symbols))):
|
| 45 |
+
print(i, repr(symbols[i]))
|
| 46 |
+
|
| 47 |
+
print("==================================\n")
|
| 48 |
+
|
| 49 |
+
except Exception as e:
|
| 50 |
+
print("❌ SYMBOL DEBUG ERROR:", e)
|
| 51 |
+
# =================================================
|
| 52 |
+
|
| 53 |
# LOAD speaker2refs.json
|
| 54 |
# =========================
|
| 55 |
if not os.path.isfile(SPEAKER2REFS_PATH):
|