stephenhoang commited on
Commit
d94a53e
·
verified ·
1 Parent(s): 9142af2

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +20 -0
inference.py CHANGED
@@ -293,6 +293,26 @@ class StyleTTS2(torch.nn.Module):
293
 
294
  tokens = [0] + tokens + [0]
295
  tokens = torch.LongTensor(tokens).unsqueeze(0).to(device)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
 
298
  with torch.no_grad():
 
293
 
294
  tokens = [0] + tokens + [0]
295
  tokens = torch.LongTensor(tokens).unsqueeze(0).to(device)
296
+ import yaml
297
+
298
+ config_path = "config.yaml" # <-- đổi thành path config bạn đang dùng
299
+
300
+ with open(config_path, "r", encoding="utf-8") as f:
301
+ cfg = yaml.safe_load(f)
302
+
303
+ symbols = (
304
+ list(cfg['symbol']['pad']) +
305
+ list(cfg['symbol']['punctuation']) +
306
+ list(cfg['symbol']['letters']) +
307
+ list(cfg['symbol']['letters_ipa']) +
308
+ list(cfg['symbol']['extend'])
309
+ )
310
+
311
+ for i in range(20):
312
+ print(i, repr(symbols[i]))
313
+
314
+ print("Total:", len(symbols)+1)
315
+
316
 
317
 
318
  with torch.no_grad():